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.
//package com.codeforces.competitions.year2016.julytoseptember.round363div2;

import java.io.*;
import java.util.*;

public final class TaskC
{
    public static void main(String[] args)
    {
        InputReader in = new InputReader(System.in);
        OutputWriter out = new OutputWriter(System.out);

		Solver solver = new Solver(in, out);
		solver.solve(1);

        out.flush();

        in.close();
        out.close();
    }

    static class Solver
    {
        int n, arr[], dp[][];
        InputReader in;
        OutputWriter out;

        public Solver(InputReader in, OutputWriter out)
        {
        	this.in = in;
        	this.out = out;
        }

		void solve(int testNumber)
		{
			n = in.nextInt();
			arr = in.nextIntArray(n);

			dp = new int[n][6];

			for (int i = 0; i < n; i++)
				Arrays.fill(dp[i], -1);

			out.println(dfs(0, 5));
		}

		int dfs(int index, int prev)
		{
//			System.out.println("index : " + index + ", prev : " + prev);

			if (dp[index][prev] != -1)
				return dp[index][prev];

			int answer = 0;

			if (index == n - 1)
			{
				if (prev == 1)
				{
					if (arr[index] > 1)
						answer = 0;
					else
						answer = 1;
				}
				else if (prev == 2)
				{
					if (arr[index] == 1 || arr[index] == 3)
						answer = 0;
					else
						answer = 1;
				}
				else if (prev == 5)
				{
					if (arr[index] == 0)
						answer = 1;
					else
						answer = 0;
				}

				return answer;
			}

			if (prev == 1)
			{
				if (arr[index] > 1)
					answer = dfs(index + 1, 2);
//					return dfs(index + 1, 2);
				else
					answer = 1 + dfs(index + 1, 5);
//					return 1 + dfs(index + 1, -1);
			}
			else if (prev == 2)
			{
				if (arr[index] == 1 || arr[index] == 3)
					answer = dfs(index + 1, 1);
//					return dfs(index + 1, 1);
				else
					answer = 1 + dfs(index + 1, 5);
//					return 1 + dfs(index + 1, -1);
			}
			else if (prev == 5)
			{
				if (arr[index] == 0)
					answer = 1 + dfs(index + 1, 5);
//					return 1 + dfs(index + 1, -1);
				else if (arr[index] == 1)
					answer = dfs(index + 1, 1);
//					return dfs(index + 1, 1);
				else if (arr[index] == 2)
					answer = dfs(index + 1, 2);
//					return dfs(index + 1, 2);
				else
					answer = Math.min(dfs(index + 1, 1), dfs(index + 1, 2));
//					return Math.min(dfs(index + 1, 1), dfs(index + 1, 2));
			}

			dp[index][prev] = answer;

			return answer;
		}

		void solve2(int testNumber)
		{
			n = in.nextInt();

			arr = new int[n];

			for (int i = 0; i < n; i++)
				arr[i] = in.nextInt();

			int left, right, total;

			left = total = 0;

			while (true)
			{
				if (left >= n)
					break;

				right = left;

				while (right < n && arr[right] != 0)
					right++;

				if (right == n)
				{
					total += find(left, right - 1);

					break;
				}
				else
				{
					total += find(left, right - 1);
					left = right + 1;
				}
			}

			out.println(n - total);
		}

		int find(int left, int right)
		{
			int max = 0;

			int[] doWhat = new int[n];

			if (arr[left] == 1 || arr[left] == 3)
			{
				doWhat[left] = 1; // code

				for (int i = left + 1; i <= right; i++)
				{
					if (doWhat[i - 1] == 1)
					{
						if (arr[i] > 1)
							doWhat[i] = 2;
						else
							doWhat[i] = -1;
					}
					else if (doWhat[i - 1] == 2)
					{
						if (arr[i] == 1 || arr[i] == 3)
							doWhat[i] = 1;
						else
							doWhat[i] = -1;
					}
				}

				int count = 0;

				for (int i = left; i <= right; i++)
					if (doWhat[i] == -1)
						count++;

				max = right - left + 1 - count;
			}

			if (arr[left] > 1)
			{
				doWhat[left] = 2;

				for (int i = left + 1; i <= right; i++)
				{
					if (doWhat[i - 1] == 1)
					{
						if (arr[i] > 1)
							doWhat[i] = 2;
						else
							doWhat[i] = -1;
					}
					else if (doWhat[i - 1] == 2)
					{
						if (arr[i] == 1 || arr[i] == 3)
							doWhat[i] = 1;
						else
							doWhat[i] = -1;
					}
				}

				int count = 0;

				for (int i = left; i <= right; i++)
					if (doWhat[i] == -1)
						count++;

				max = Math.max(max, right - left + 1 - count);
			}

			return max;
		}

	}

    static class InputReader
    {
        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 nextInt()
        {
            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 & 15;

                c = read();
            } while (!isSpaceChar(c));

            return res * sgn;
        }

        public int[] nextIntArray(int arraySize)
        {
            int array[] = new int[arraySize];

            for (int i = 0; i < arraySize; i++)
                array[i] = nextInt();

            return array;
        }

        public long nextLong()
        {
            int c = read();

            while (isSpaceChar(c))
                c = read();

            int sign = 1;

            if (c == '-')
            {
                sign = -1;

                c = read();
            }

            long result = 0;

            do
            {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();

                result *= 10;
                result += c & 15;

                c = read();
            } while (!isSpaceChar(c));

            return result * sign;
        }

        public long[] nextLongArray(int arraySize)
        {
            long array[] = new long[arraySize];

            for (int i = 0; i < arraySize; i++)
                array[i] = nextLong();

            return array;
        }

        public float nextFloat() // problematic
        {
            float result, div;
            byte c;

            result = 0;
            div = 1;
            c = (byte) read();

            while (c <= ' ')
                c = (byte) read();

            boolean isNegative = (c == '-');

            if (isNegative)
                c = (byte) read();

            do
            {
                result = result * 10 + c - '0';
            } while ((c = (byte) read()) >= '0' && c <= '9');

            if (c == '.')
                while ((c = (byte) read()) >= '0' && c <= '9')
                    result += (c - '0') / (div *= 10);

            if (isNegative)
                return -result;

            return result;
        }

        public double nextDouble() // not completely accurate
        {
            double ret = 0, div = 1;
            byte c = (byte) read();

            while (c <= ' ')
                c = (byte) read();

            boolean neg = (c == '-');

            if (neg)
                c = (byte) read();

            do
            {
                ret = ret * 10 + c - '0';
            } while ((c = (byte) read()) >= '0' && c <= '9');

            if (c == '.')
                while ((c = (byte) read()) >= '0' && c <= '9')
                    ret += (c - '0') / (div *= 10);

            if (neg)
                return -ret;

            return ret;
        }

        public String next()
        {
            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 boolean isSpaceChar(int c)
        {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public String nextLine()
        {
            int c = read();

            StringBuilder result = new StringBuilder();

            do
            {
                result.appendCodePoint(c);

                c = read();
            } while (!isNewLine(c));

            return result.toString();
        }

        public boolean isNewLine(int c)
        {
            return c == '\n';
        }

        public void close()
        {
            try
            {
                stream.close();
            } catch (IOException e)
            {
                e.printStackTrace();
            }
        }

    }

    static class OutputWriter
    {
        private PrintWriter writer;

        public OutputWriter(OutputStream stream)
        {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(
                    stream)));
        }

        public OutputWriter(Writer writer)
        {
            this.writer = new PrintWriter(writer);
        }

        public void println(int x)
        {
            writer.println(x);
        }

        public void print(int x)
        {
            writer.print(x);
        }

		public void println(char x)
		{
			writer.println(x);
		}

		public void print(char x)
		{
			writer.print(x);
		}

        public void println(int array[], int size)
        {
            for (int i = 0; i < size; i++)
                println(array[i]);
        }

        public void print(int array[], int size)
        {
            for (int i = 0; i < size; i++)
                print(array[i] + " ");
        }

        public void println(long x)
        {
            writer.println(x);
        }

        public void print(long x)
        {
            writer.print(x);
        }

        public void println(long array[], int size)
        {
            for (int i = 0; i < size; i++)
                println(array[i]);
        }

        public void print(long array[], int size)
        {
            for (int i = 0; i < size; i++)
                print(array[i]);
        }

        public void println(float num)
        {
            writer.println(num);
        }

        public void print(float num)
        {
            writer.print(num);
        }

        public void println(double num)
        {
            writer.println(num);
        }

        public void print(double num)
        {
            writer.print(num);
        }

        public void println(String s)
        {
            writer.println(s);
        }

        public void print(String s)
        {
            writer.print(s);
        }

        public void println()
        {
            writer.println();
        }

        public void printSpace()
        {
            writer.print(" ");
        }

        public void flush()
        {
            writer.flush();
        }

        public void close()
        {
            writer.close();
        }

    }

	static class CMath
	{
		static long power(long number, long power)
		{
			if (number == 1 || number == 0 || power == 0)
				return 1;

			if (power == 1)
				return number;

			if (power % 2 == 0)
				return power(number * number, power / 2);
			else
				return power(number * number, power / 2) * number;
		}

		static long modPower(long number, long power, long mod)
		{
			if (number == 1 || number == 0 || power == 0)
				return 1;

			number = mod(number, mod);

			if (power == 1)
				return number;

			long square = mod(number * number, mod);

			if (power % 2 == 0)
				return modPower(square, power / 2, mod);
			else
				return mod(modPower(square, power / 2, mod) * number, mod);
		}

		static long moduloInverse(long number, long mod)
		{
			return modPower(number, mod - 2, mod);
		}

		static long mod(long number, long mod)
		{
			return number - (number / mod) * mod;
		}

		static int gcd(int a, int b)
		{
			if (b == 0)
				return a;
			else
				return gcd(b, a % b);
		}

	}

}
