var
n,i,tmp:longint;
f:array[0..30000,1..2] of longint;
function min(a,b:longint):longint;
begin
if a>b then min:=b else min:=a;
end;
begin
assign(input,'diningb.in');
reset(input);
assign(output,'diningb.out');
rewrite(output);
readln(n);
for i:=1 to n do
begin
readln(tmp);
f[i,1]:=f[i-1,1]+(tmp xor 1) div 3;
f[i,2]:=min(f[i-1,1]+(tmp xor 2) div 3,f[i-1,2]+(tmp xor 2) div 3);
end;
writeln(min(f[n,1],f[n,2]));
close(input);
close(output);
end.