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.math.*;

public class C {
    public static void main(String args[]) {
        try {
            InputReader in = new InputReader(System.in);
            int n = in.readInt();
            int gs[][] = new int[n][2];
            for (int i = 0; i < n; i++) {
                int ind = in.readInt();
                if (ind == 0) {
                    gs[i][0] = 0;
                    gs[i][1] = 0;
                }
                else if(ind == 1) {
                    gs[i][0] = 0;
                    gs[i][1] = 1;
                }
                else if(ind == 2) {
                    gs[i][0] = 1;
                    gs[i][1] = 0;
                }
                else{
                    gs[i][0] = 1;
                    gs[i][1] = 1;
                }
            }
            int dp[][] = new int[n][2];
            dp[0][0] = gs[0][0];
            dp[0][1] = gs[0][1];
            for (int i = 1; i < n; i++) {
                dp[i][0] = dp[i - 1][1];
                if (gs[i][0] == 0){
                    dp[i][0] = Math.max(dp[i][0], dp[i - 1][0]);
                }
                else if(gs[i][0] == 1) {
                    if (i - 2 >= 0 && gs[i - 2][0] == 1) {
                        dp[i][0] = Math.max(dp[i][0], dp[i - 2][0] + 1);
                    }
                    if (gs[i - 1][0] == 0) {
                        dp[i][0] = Math.max(dp[i][0], dp[i - 1][0] + 1);
                    }
                    if (i - 2 >= 0) {
                        dp[i][0] = Math.max(dp[i][0], dp[i - 2][1] + 1);
                        dp[i][0] = Math.max(dp[i][0], dp[i - 2][0] + 1);
                    }
                    dp[i][0] = Math.max(dp[i][0], dp[i - 1][1] + 1);
                }
                dp[i][1] = dp[i - 1][0];
                if (gs[i][1] == 0) {
                    dp[i][1] = Math.max(dp[i][1], dp[i - 1][1]);
                }
                else if(gs[i][1] == 1) {
                    if (i - 2 >= 0 && gs[i - 2][1] == 1) {
                        dp[i][1] = Math.max(dp[i][1], dp[i - 2][1] + 1);
                    }
                    if(gs[i - 1][1] == 0) {
                        dp[i][1] = Math.max(dp[i][1], dp[i - 1][1] + 1);
                    }
                    if (i - 2 >= 0) {
                        dp[i][1] = Math.max(dp[i][1], dp[i - 2][0] + 1);
                        dp[i][1] = Math.max(dp[i][1], dp[i - 2][1] + 1);
                    }
                    dp[i][1] = Math.max(dp[i][1], dp[i - 1][0] + 1);
                }
            }
//            for (int i = 0; i < n; i++) {
//                System.out.println(Arrays.toString(dp[i]));
//            }
            System.out.println(n - Math.max(dp[n - 1][0], dp[n - 1][1]));
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
class InputReader {
    private boolean finished = false;

    private InputStream stream;
    private byte[] buf = new byte[1024];
    private int curChar;
    private int numChars;

    public InputReader(InputStream stream) {
        this.stream = stream;
    }

    public int read() {
        if (numChars == -1)
            throw new InputMismatchException();
        if (curChar >= numChars) {
            curChar = 0;
            try {
                numChars = stream.read(buf);
            } catch (IOException e) {
                throw new InputMismatchException();
            }
            if (numChars <= 0)
                return -1;
        }
        return buf[curChar++];
    }

    public int peek() {
        if (numChars == -1)
            return -1;
        if (curChar >= numChars) {
            curChar = 0;
            try {
                numChars = stream.read(buf);
            } catch (IOException e) {
                return -1;
            }
            if (numChars <= 0)
                return -1;
        }
        return buf[curChar];
    }

    public int readInt() {
        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 long readLong() {
        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 String readString() {
        int length = readInt();
        if (length < 0)
            return null;
        byte[] bytes = new byte[length];
        for (int i = 0; i < length; i++)
            bytes[i] = (byte) read();
        try {
            return new String(bytes, "UTF-8");
        } catch (UnsupportedEncodingException e) {
            return new String(bytes);
        }
    }

    public static boolean isSpaceChar(int c) {
        return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
    }

    private String readLine0() {
        StringBuffer buf = new StringBuffer();
        int c = read();
        while (c != '\n' && c != -1) {
            if (c != '\r')
                buf.appendCodePoint(c);
            c = read();
        }
        return buf.toString();
    }

    public String readLine() {
        String s = readLine0();
        while (s.trim().length() == 0)
            s = readLine0();
        return s;
    }

    public String readLine(boolean ignoreEmptyLines) {
        if (ignoreEmptyLines)
            return readLine();
        else
            return readLine0();
    }

    public BigInteger readBigInteger() {
        try {
            return new BigInteger(readString());
        } catch (NumberFormatException e) {
            throw new InputMismatchException();
        }
    }

    public char readCharacter() {
        int c = read();
        while (isSpaceChar(c))
            c = read();
        return (char) c;
    }

    public double readDouble() {
        int c = read();
        while (isSpaceChar(c))
            c = read();
        int sgn = 1;
        if (c == '-') {
            sgn = -1;
            c = read();
        }
        double res = 0;
        while (!isSpaceChar(c) && c != '.') {
            if (c == 'e' || c == 'E')
                return res * Math.pow(10, readInt());
            if (c < '0' || c > '9')
                throw new InputMismatchException();
            res *= 10;
            res += c - '0';
            c = read();
        }
        if (c == '.') {
            c = read();
            double m = 1;
            while (!isSpaceChar(c)) {
                if (c == 'e' || c == 'E')
                    return res * Math.pow(10, readInt());
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                m /= 10;
                res += (c - '0') * m;
                c = read();
            }
        }
        return res * sgn;
    }

    public boolean isExhausted() {
        int value;
        while (isSpaceChar(value = peek()) && value != -1)
            read();
        return value == -1;
    }

    public String next() {
        return readString();
    }

    public boolean readBoolean() {
        return readInt() == 1;
    }
}

