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.
/*
Some say the world will end in fire,
Some say in ice.
From what I've tasted of desire
I hold with those who favor fire.
But if it had to perish twice,
I think I know enough of hate
To say that for destruction ice
Is also great
And would suffice.
*/
import java.io.*;
import java.util.*;
 
public final class Main{

    public static final long MOD = 1000000007;
    public static final int limit = 500005;
    
    public static long GCD(long a, long b) {
        while(b != 0){
            long temp = a;
            a = b;
            b = temp % b;
        }
        return a;
    }
    
    static class InputReader {
 
        private final InputStream stream;
        private final byte[] buf = new byte[8192];
        private int curChar, snumChars;
        private SpaceCharFilter filter;
 
        public InputReader(InputStream stream) {
            this.stream = stream;
        }
 
        public int snext() {
            if (snumChars == -1)
                throw new InputMismatchException();
            if (curChar >= snumChars) {
                curChar = 0;
                try {
                    snumChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (snumChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }
 
        public int nextInt() {
            int c = snext();
            while (isSpaceChar(c)) {
                c = snext();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = snext();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = snext();
            } while (!isSpaceChar(c));
            return res * sgn;
        }
 
        public long nextLong() {
            int c = snext();
            while (isSpaceChar(c)) {
                c = snext();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = snext();
            }
            long res = 0;
            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = snext();
            } while (!isSpaceChar(c));
            return res * sgn;
        }
 
        public int[] nextIntArray(int n) {
            int a[] = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = nextInt();
            }
            return a;
        }
 
        public String readString() {
            int c = snext();
            while (isSpaceChar(c)) {
                c = snext();
            }
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = snext();
            } while (!isSpaceChar(c));
            return res.toString();
        }
 
        public String nextLine() {
            int c = snext();
            while (isSpaceChar(c))
                c = snext();
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = snext();
            } while (!isEndOfLine(c));
            return res.toString();
        }
 
        public boolean isSpaceChar(int c) {
            if (filter != null)
                return filter.isSpaceChar(c);
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }
 
        private boolean isEndOfLine(int c) {
            return c == '\n' || c == '\r' || c == -1;
        }
 
        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);
        }
    }

    public static int getMinimumRest(int[] A, int[][] dp, int prev, int i){
        //System.out.println("prev = " + prev + "i = " + i);
        if(i >= A.length)   return 0;
        if(dp[prev][i] != 500)     return dp[prev][i];
        switch(A[i]){
            case 0:
                //coding -> no gym -> no... take rest
                dp[prev][i] = 1 + getMinimumRest(A, dp, 0, i + 1);
                break;
            case 1:
                //coding -> yes gym -> no
                if(prev == 2){
                    dp[prev][i] = 1 + getMinimumRest(A, dp, 0, i + 1);
                }
                else{
                    dp[prev][i] = Math.min(1 + getMinimumRest(A, dp, 0, i + 1), getMinimumRest(A, dp, 2, i + 1));
                }
                break;
            case 2:
                //gym -> yes coding -> no
                //System.out.println("reached here");
                if(prev == 1){
                    //System.out.println("To for i = " + (i + 1) + "min = " + getMinimumRest(A, dp, 0, i + 1));
                    dp[1][i] = 1 + getMinimumRest(A, dp, 0, i + 1);
                }
                else{
                    //System.out.println("To for i = " + (i + 1) + "min 1= " + getMinimumRest(A, dp, 0, i + 1) + "min 2= " + getMinimumRest(A, dp, 1, i + 1));
                    dp[prev][i] = Math.min(1 + getMinimumRest(A, dp, 0, i + 1), getMinimumRest(A, dp, 1, i + 1));
                }
                break;
            case 3:
                //gym -> yes coding -> yes
                if(prev == 1){
                    dp[prev][i] = Math.min(1 + getMinimumRest(A, dp, 0, i + 1), getMinimumRest(A, dp, 2, i + 1));
                }
                else if(prev == 2){
                    dp[prev][i] = Math.min(1 + getMinimumRest(A, dp, 0, i + 1), getMinimumRest(A, dp, 1, i + 1));
                }
                else{
                    dp[prev][i] = Math.min( Math.min(1 + getMinimumRest(A, dp, 0, i + 1), getMinimumRest(A, dp, 1, i + 1)), getMinimumRest(A, dp, 2, i + 1));
                }
                break;
            default:
                break;
        }
        return dp[prev][i];
    }
    public static void main(String[] args) {
        InputReader in = new InputReader(System.in);
        PrintWriter w = new PrintWriter(System.out);
 
        //int t = in.nextInt();
        int t = 1;
        while (t-- > 0) {
            if (System.getProperty("ONLINE_JUDGE") == null) w.println("=========================================");
            int n = in.nextInt();
            int[] A = new int[n];
            for(int i = 0; i < n; i++){
                A[i] = in.nextInt();
            }
            int[][] dp = new int[3][n];
            for(int i = 0; i < 3; i++){
                Arrays.fill(dp[i], 500);
            }
            //for(int x : dp) w.print(x + " ");
            //prev day 
            //0 -> rest 1 -> gym 2 -> coding
            getMinimumRest(A, dp, 0, 0);
            w.println(Math.min(dp[0][0], Math.min(dp[1][0], dp[2][0])));
            //for(int x : dp) w.print(x + " ");
        }
        w.close();
    }
}