Vasya has n days of vacations! So he decided to improve his IT skills and do sport. Vasya knows the following information about each of this n days: whether that gym opened and whether a contest was carried out in the Internet on that day. For the i-th day there are four options:

  1. on this day the gym is closed and the contest is not carried out; 
  2. on this day the gym is closed and the contest is carried out; 
  3. on this day the gym is open and the contest is not carried out; 
  4. on this day the gym is open and the contest is carried out. 



On each of days Vasya can either have a rest or write the contest (if it is carried out on this day), or do sport (if the gym is open on this day).

Find the minimum number of days on which Vasya will have a rest (it means, he will not do sport and write the contest at the same time). The only limitation that Vasya has — he does not want to do the same activity on two consecutive days: it means, he will not do sport on two consecutive days, and write the contest on two consecutive days.

Input

The first line contains a positive integer n (1 ≤ n ≤ 100) — the number of days of Vasya's vacations.

The second line contains the sequence of integers a1, a2, ..., an (0 ≤ ai ≤ 3) separated by space, where: 

  * ai equals 0, if on the i-th day of vacations the gym is closed and the contest is not carried out; 
  * ai equals 1, if on the i-th day of vacations the gym is closed, but the contest is carried out; 
  * ai equals 2, if on the i-th day of vacations the gym is open and the contest is not carried out; 
  * ai equals 3, if on the i-th day of vacations the gym is open and the contest is carried out.

Output

Print the minimum possible number of days on which Vasya will have a rest. Remember that Vasya refuses:

  * to do sport on any two consecutive days, 
  * to write the contest on any two consecutive days. 

Examples

Input

4
1 3 2 0


Output

2


Input

7
1 3 3 2 1 2 3


Output

0


Input

2
2 2


Output

1

Note

In the first test Vasya can write the contest on the day number 1 and do sport on the day number 3. Thus, he will have a rest for only 2 days.

In the second test Vasya should write contests on days number 1, 3, 5 and 7, in other days do sport. Thus, he will not have a rest for a single day.

In the third test Vasya can do sport either on a day number 1 or number 2. He can not do sport in two days, because it will be contrary to the his limitation. Thus, he will have a rest for only one day.
import java.io.*;
import java.util.*;
import java.util.Queue;
import java.util.LinkedList;
import java.util.Stack;
public class Fast
{
    @SuppressWarnings("unused")
    static int m=1000;
   static void rec(int a[],int p[],int min,int ind)
   {
       if(ind==a.length || min>=m)
       m=Math.min(m,min);
       else
       {
           if(a[ind]==0)
           {
           rec(a,p,min+1,ind+1);
        }
        else if(a[ind]==1)
        {
            if(ind==0)
            {
                
                p[ind]=1;
                rec(a,p,min,ind+1);
            }
            else if(p[ind-1]==1)
            {
                p[ind]=0;
                rec(a,p,min+1,ind+1);
            }
            else
            {
                 p[ind]=1;
                rec(a,p,min,ind+1);
                
            }
            
        }
        else if(a[ind]==2)
        {
            if(ind==0)
            {
                
                p[ind]=2;
                rec(a,p,min,ind+1);
            }
            else if(p[ind-1]==2)
            {
                p[ind]=0;
                rec(a,p,min+1,ind+1);
            }
            else
            {
                 p[ind]=2;
                rec(a,p,min,ind+1);
                
            }
            
        }
        else
        {
            if(ind==0||p[ind-1]==0)
            {
                
                p[ind]=1;
                rec(a,p,min,ind+1);
                p[ind]=2;
                rec(a,p,min,ind+1);
            }
            else if(p[ind-1]==1)
            {
                p[ind]=2;
                rec(a,p,min,ind+1);
            }
            else
            {
                 p[ind]=1;
                rec(a,p,min,ind+1);
                
            }
            
            
        }
        
           
           
        }
    }
     public static void main(String args[])throws IOException
    {
        Reader ob=new Reader();
        Writer out=new Writer(System.out);
        int n=ob.nI();
        int a[]=ob.NIA(n);
        int p[]=new int[n];
        int rest=0;
        if(a[0]==0)
        rest++;
        for(int i=1;i<n;i++)
        {
            if(a[i]==0)
            rest++;
            else if(a[i]==1)
            {
                if(a[i-1]==1)
                {
                    a[i]=0;
                rest++;
            }
            }
            else if(a[i]==2)
            {
                if(a[i-1]==2)
                {
                    a[i]=0;
                rest++;
            }
            }
            else
            {
                if(a[i-1]==1)
                a[i]=2;
                else if(a[i-1]==2)
                a[i]=1;
            }
        }
            
        out.pln(rest);
    out.flush();
}
public static void bfs(int s, ArrayList<Integer> adj[],boolean vis[])
    {
        //Add your code here.
        Queue<Integer> q=new LinkedList<Integer>();
        q.add(s);
        vis[s]=true;
        while(!q.isEmpty())
        {
            int r=q.remove();
            int l=adj[r].size();
            for(int i=0;i<l;i++)
            {
                int y=adj[r].get(i);
                if(!vis[y])
                {
                    q.add(y);
                    vis[y]=true;
                }
            }
            System.out.print(r+" ");
        }
    }
static void debug(Object... o) {
        System.err.println(Arrays.deepToString(o));
    }
static long inverse(long x, long p)
    {
        return pow(x, p - 2, p);
    }
static boolean isPrime(long n)
{
    long h=(long)Math.sqrt(n);
    for(long i=2;i<=h;i++)
    if(n%i==0)
    return false;
    return true&&n!=1;
}
    static long gcd(long a,long b)
    {
        if(a<b)
        return gcd(b,a);
        else if(b==0)
        return a;
        else
        return gcd(b,a%b);
    }
    static long pow(long a,long b,long mod){
		if(b == 0)	return 1;
		long t = pow(a,b>>1,mod);
		t = (t * t) % mod;
		if((b & 1) == 1)	t = (t * a);
		if(t >= mod)	t %= mod;
		return t;
}
    static long pow(long a,long b){
		if(b == 0)	return 1;
		long t = pow(a,b>>1);
		t = (t * t);
		if((b & 1) == 1)	t = (t * a);
		return t;
}
    static void seive(int n,int prime[])//1 for prime -1 for not prime
    {
        for(int i=2;i<=n;i++)
            if(prime[i]==0)
            {
                prime[i]=1;
                for(int j=2;j*i<=n;j++)
                prime[j*i]=-1;
            }
    }
    static int max(int ...a)
    {
        int m=a[0];
        for(int i=0;i<a.length;i++)
        m=Math.max(m,a[i]);
        return m;
        
    }
    static long max(long ...a)
    {
        long m=a[0];
        for(int i=0;i<a.length;i++)
        m=Math.max(m,a[i]);
        return m;
    }
    static int min(int ...a)
    {
        int m=a[0];
        for(int i=0;i<a.length;i++)
        m=Math.min(m,a[i]);
        return m;
    }
    static long min(long ...a)
    {
        long m=a[0];
        for(int i=0;i<a.length;i++)
        m=Math.min(m,a[i]);
        return m;
    }
    static class Pair
    {
        int x=0,y=0;
        Pair(int xx,int yy)
        {
            x=xx;
            y=yy;
        }
    }
	static class Writer {
		private final PrintWriter p;
		Writer(OutputStream o) {
			p = new PrintWriter(new BufferedWriter(new OutputStreamWriter(o)));
		}
		void p(Object... o1) {
			for (Object o11 : o1) {
				p.print(o11 + "" );
			}
		}
		void p(String s) {
			p.print(s);
		}
		void pln(Object... o1) {
			p(o1);
			p.println();
		}
		void flush() {
			p.flush();
		}
		void close() {
			p.close();
		}
	}
    static class Reader {
		private byte[] buf = new byte[1024];
		private int curChar;
		private int snumChars;
		public int read() {
			if (snumChars == -1)
				throw new InputMismatchException();
			if (curChar >= snumChars) {
				curChar = 0;
				try {
					snumChars = System.in.read(buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (snumChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}
		public String nl() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isEndOfLine(c));
			return res.toString();
		}
		public String n() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isSpaceChar(c));
			return res.toString();
		}
		public long nL() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			long res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}
		public int nI() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			int res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}
		public int[] NIA(int n) //nextINtArray
		{
			int[] arr = new int[n];
			for (int i = 0; i < n; i++) {
				arr[i] = nI();
			}
			return arr;
		}
		
		public long[] NLA(int n) //nextLongArray
		{
			long[] arr = new long[n];
			for (int i = 0; i < n; i++) {
				arr[i] = nL();
			}
			return arr;
}
		private boolean isSpaceChar(int c) {
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}
		private boolean isEndOfLine(int c) {
			return c == '\n' || c == '\r' || c == -1;
		}
	}
}