happy-birthday
Source: hackerearth
Difficulty: UNKNOWN_DIFFICULTY

After the lessons n groups of friends went outside and decided to visit Pawan to celebrate his birthday. We know that the i-th group consists of si friends (1 ≤ si ≤ 4), and they want to go to Pawan together. They decided to get there by taxi. Each car can carry at most four passengers. What minimum number of cars will the children need if all members of each group should ride in the same taxi (but one taxi can take more than one group)?

Input
The first line contains integer n (1 ≤ n ≤ 105) — the number of groups of schoolchildren. The second line contains a sequence of integers s1, s2, ..., sn (1 ≤ si ≤ 4). The integers are separated by a space, si is the number of children in the i-th group.

Output
Print the single number — the minimum number of taxis necessary to drive all children to Pawan.

SAMPLE INPUT
5
1 2 4 3 3

SAMPLE OUTPUT
4


'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
#print 'Hello World!'
n=eval(input())
l=[int(i) for i in input().split()]
s=sum(l)
if s%4==0:
	print(s/4)
else:
	print(s/4+1)
			
	


import math
n=int(input())
s=input()
s=s.split(' ')
s=list(s)
s=list(map(int,s))
sum=math.fsum(s)
sum=sum/4
print(int(math.ceil(sum)))


n=eval(input())
s=list(map(int,input().split(' ')))
val=sum(s)
x=val/4
if(val%4!=0):
	x=x+1
print(x)


#tests=int(raw_input())
#no_of_taxi=[]
#for p in range(0,tests):
N=int(input())
grp=list(input())
no_ones=0
no_twos=0
no_threes=0
for x in range(0,(2*N-1),2):
	if (int(grp[x]))==1:
		no_ones=no_ones+1
for y in range(0,(2*N-1),2):
	if (int(grp[y]))==2:
		no_twos=no_twos+1
for z in range(0,(2*N-1),2):
	if (int(grp[z]))==3:
		no_threes=no_threes+1
no_four=N-(no_ones+no_twos+no_threes)
no_taxi=(no_ones+(no_twos*2)+(no_threes*3))//4
if((no_ones+(no_twos*2)+(no_threes*3))%4) > 0:
	print((no_taxi+no_four+1))
else:
	print((no_taxi+no_four))