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.lang.*;
public class Vacations {

    public static void main(String[] args) throws IOException {
        FastScanner sc= new FastScanner(System.in);
        int N= sc.ni();
        int[] array= new int[N];
        for (int x=0; x<N; x++){
            array[x]= sc.ni();
        }
        System.out.println(recurse(array, 0, 0));

    }
    static HashMap<String, Integer> memo= new HashMap<>();
    public static int recurse(int[] array, int prev, int index){
        String key= prev+":"+index;
        if (memo.containsKey(key))return memo.get(key);
        if (index==array.length) return 0;
        int total=0;
        if (array[index]==0){
            total+= 1+ recurse(array, 0, index+1);
        }
        if (array[index]==1){
            if (prev!=1) total+= recurse(array, 1, index+1);
            else total+= 1+ recurse(array, 0, index+1);
        }
        if (array[index]==2){
            if (prev!=2) total+= recurse(array,2, index+1);
            else total+= 1+ recurse(array, 0, index+1);
        }
        if (array[index]==3){
            if (prev==0){
                int type1= recurse(array, 1, index+1);
                int type2= recurse(array, 2, index+1);
                total+= Math.min(type1, type2);
            }
            else if (prev!=2) total+= recurse(array, 2, index+1);
            else if (prev!=1) total+= recurse(array, 1, index+1);
        }
        memo.put(key, total);
        return total;
    }




/*
My library of useful things :)
*/
    static class Pair implements Comparable<Pair>{
        int first;
        int second;
        public Pair(int a, int b){
            first=a;
            second=b;
        }
        public int compareTo(Pair obj){
            if (obj.first==first){
                return second-obj.second;
            }
            else return first-obj.first;
        }
    }
    static class djset{
        int N;
        int[] parent;

        // Creates a disjoint set of size n (0, 1, ..., n-1)
        public djset(int n) {
            parent = new int[n];
            N=n;
            for (int i=0; i<n; i++)
                parent[i] = i;
        }

        public int find(int v) {

            // I am the club president!!! (root of the tree)
            if (parent[v] == v) return v;

            // Find my parent's root.
            int res = find(parent[v]);

            // Attach me directly to the root of my tree.
            parent[v] = res;
            return res;
        }

        public boolean union(int v1, int v2) {

            // Find respective roots.
            int rootv1 = find(v1);
            int rootv2 = find(v2);

            // No union done, v1, v2 already together.
            if (rootv1 == rootv2) return false;

            // Attach tree of v2 to tree of v1.
            parent[rootv2] = rootv1;
            return true;
        }


    }
    static class FastScanner {
        public BufferedReader br;
        public StringTokenizer st;
        public FastScanner(InputStream name) throws IOException {
            br = new BufferedReader(new InputStreamReader(name),32768);
            st = null;
        }

        public String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException  e) {
                    throw new RuntimeException(e);
                }
            }
            return st.nextToken();
        }

        public int ni() {
            return Integer.parseInt(next());
        }

        public long nl() {
            return Long.parseLong(next());
        }

        public double nd() {
            return Double.parseDouble(next());
        }

        public String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
            return str;
        }
    }
}

