uses crt;
var i,n,ans:longint;
x:byte;
a:array[1..4] of longint;
procedure Enter;
begin
readln(n);
for i:=1 to n do
begin
read(x);
inc(a[x]);
end;
readln;
end;
procedure Gop1voi3;
begin
inc(ans,a[3]);
dec(a[1],a[3]);
end;
procedure Gop2voi2;
begin
inc(ans,a[2] div 2);
a[2]:=a[2] mod 2;
end;
procedure Gop1voi2;
begin
if a[2]>0 then
begin
inc(ans);
dec(a[1],2);
end;
if a[1]>0 then
begin
inc(ans,a[1] div 4);
if a[1] mod 4 <> 0 then inc(ans);
end;
end;
begin
clrscr;
Enter;
//for i:=1 to 4 do write(a[i],' ');
ans:=a[4];
Gop1voi3;
Gop2voi2;
Gop1voi2;
write(ans);
readln
end.