Little girl Susie went shopping with her mom and she wondered how to improve service quality. 

There are *n* people in the queue. For each person we know time *t*<sub class="lower-index">*i*</sub> needed to serve him. A person will be disappointed if the time he waits is more than the time needed to serve him. The time a person waits is the total time when all the people who stand in the queue in front of him are served. Susie thought that if we swap some people in the queue, then we can decrease the number of people who are disappointed. 

Help Susie find out what is the maximum number of not disappointed people can be achieved by swapping people in the queue.
The first line contains integer *n* (1 ≤ *n* ≤ 10<sup class="upper-index">5</sup>).

The next line contains *n* integers *t*<sub class="lower-index">*i*</sub> (1 ≤ *t*<sub class="lower-index">*i*</sub> ≤ 10<sup class="upper-index">9</sup>), separated by spaces.
n = int(input())
group_sizes = list(map(int, input().split()))

count = [0] * 5  # 创建一个长度为5的列表，用于统计不同大小的小学生组数量
for size in group_sizes:
    count[size] += 1

# 计算出租车数量
num_taxis = count[4]  # 先将4人组的数量加到出租车数量中
count[1] -= count[3]  # 减去1人组中与3人组匹配的数量
num_taxis += count[2] // 2  # 每辆出租车最多搭载两个2人组
count[2] %= 2  # 处理未匹配的2人组

# 处理未匹配的1人组
if count[2] > 0:
    num_taxis += 1
    count[1] -= 2

if count[1] > 0:
    num_taxis += (count[1] + 3) // 4  # 每辆出租车最多搭载四个1人组

print(num_taxis)