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.
# TODO
#
# - [ ] DP
#   - [ ] Forward
#   - [ ] Backward
# - [X] Memoization
# - [X] BFS solution
#
# NOTES
#
# Actually, recursion itself isn't even necessarily right to left. In fact we
# should be thinking of it as starting at one step in the tree and using that
# result to compute the next one to the right. So that unifies all of these
# approaches as building a tree from left to right.
#
# Hmm, I'll actually have to think about that a little bit more. I've always
# thought of recursion as "OK we're interested in computing F(n). How can we use
# F(n-1) to do that?" Not "OK we have F(n-1). How can we use it to compute
# F(n)?" Indeed, during Jaime and Arnav's lectures on DP, they very much used a
# "F(n) in terms of F(n-1)" approach. The "F(n-1) to F(n)" corresponds more
# naturally to induction.
#
# Take fibonnaci for example. If you started thinking in terms of "How can I
# use F(n-1) to compute F(n)?" Well you would have to say "I also need F(n-2).
# Then I could use them both to compute F(n)." But perhaps this is more
# cumbersome than saying "I have F(n). I know by definition that it *is* F(n-2)
# and F(n-1)." In this sense, it is definitional. The left-to-right approach is
# more constructivist in its nature. This is perhaps useful for DP.
#
# Although DP can still be viewed as successive right-to-left operations (e.g.
# F(2) in terms of F(1), then F(3) in terms of F(2), and so on). In this case,
# we are just applying repeated definitions of the recursion rule. As opposed to
# having F(1), then using it to compute (or "construct") F(2), then using F(2)
# to construct F(3). In this sense we are going forward and it /feels/ more
# natural, though less general somehow.
#

def memoize(f):
    d = {}
    def wrapper(*args):
        if args not in d:
            d[args] = f(*args)
        return d[args]
    return wrapper

def min_rest(T, A):
    """Minimum days to rest at time `T` given agenda `A`

    Parameters
    ----------
    T : day
    A : list of options for every day

    """
    if T == 1:
        return 1 if A[0] == set([REST]) else 0

    @memoize
    def rest_recursive(t, today_activity, depth=0):
        """Minimum days of rest ending in today's activity

        Parameters
        ----------
        t : day
        today_activity : either CONTEST, GYM, or REST

        Delete gym or contest from yesterday's activities if today's activity is
        either CONTEST or GYM.

        """
        # print '{}rest_recursive(t={}, today_activity={}'.format(' '*depth, t, N[today_activity])
        if t == 1:
            min_rest = 1 if today_activity == REST else 0
            # print '{}found min_rest={} for t={}, today_activity={}'.format(' '*depth, min_rest, t, N[today_activity])
            return min_rest

        min_rest = 1e100
        for yesterday_activity in A[t-1]:
            if today_activity == yesterday_activity and today_activity in [GYM, CONTEST]:
                continue

            nb_rest = rest_recursive(t-1, yesterday_activity, depth+4)
            nb_rest += 1 if today_activity == REST else 0
            min_rest = min(nb_rest, min_rest)

        # print '{}found min_rest={} for t={}, today_activity={}'.format(' '*depth, min_rest, t, N[today_activity])
        return min_rest

    min_rest = 1e100
    for today_activity in A[-1]:
        for yesterday_activity in A[T-1]:
            if today_activity == yesterday_activity and today_activity in [GYM, CONTEST]:
                continue

            nb_rest = rest_recursive(T-1, yesterday_activity)
            nb_rest += 1 if today_activity == REST else 0
            min_rest = min(nb_rest, min_rest)

    return min_rest

def bfs_solve(A, n):
    """Breadth-first search solution
    
    State
    -----
    t : time step
    activity : activity @ time `t`
    nb_rest : number of rests taken

    Variables
    ---------
    Q : bfs queue
    R : nb_activity x n table where R[i][j] = minimum number of rests for path
        ending in activity i @ timestep j found so far

    """
    from collections import deque

    Q = deque()
    for activity in A[0]:
        Q.append([0, activity, 1 if activity == REST else 0])

    R = [[1e100]*n for _ in range(3)]
    for activity in A[0]:
        R[activity][0] = 1 if activity == REST else 0

    # for r in R:
    #     print r
    # print

    while Q:
        t, activity, nb_rest = Q.popleft()
        # print 'popped t={}, {}, nb_rest={}'.format(t, N[activity], nb_rest)

        if t == n-1:
            # print 'done, t == n'
            # print
            continue # don't add more neighbors

        if nb_rest > R[activity][t]:
            # print 'better node added in the meantime'
            # print
            continue # better node may have been added in the mean time

        # Add neighbors
        for tomorrow_activity in A[t+1]:
            if activity == tomorrow_activity and activity in [CONTEST, GYM]:
                continue # no repeats

            tomorrow_rest = nb_rest
            tomorrow_rest += 1 if tomorrow_activity == REST else 0
            if tomorrow_rest >= R[tomorrow_activity][t+1]:
                continue # already found as good or better path

            # print 'adding t={}, {}, nb_rest={}'.format(t+1, N[tomorrow_activity], tomorrow_rest)
            R[tomorrow_activity][t+1] = tomorrow_rest
            Q.append([t+1, tomorrow_activity, tomorrow_rest]) # path checks out

        # for r in R:
        #     print r
        # print

    return min(R[i][n-1] for i in range(3))

def dp_backward_solve(A, n):
    """DP solution

    Starting with dp[i], compute it from dp[i-1].

    """
    if n == 1:
        return 1 if A[0] == set([REST]) else 0

    best = {REST: 1, CONTEST: 0, GYM: 0}

    for i in range(1, n):
        new_best = {REST: 1e100, CONTEST: 1e100, GYM: 1e100}
        for activity in A[i]:
            for yesterday_activity in A[i-1]:
                if activity == yesterday_activity and activity in [CONTEST, GYM]:
                    continue

                nb_rest = best[yesterday_activity]
                nb_rest += 1 if activity == REST else 0
                new_best[activity] = min(nb_rest, new_best[activity])

        best = new_best

    return min(best.values())

def dp_forward_solve(A, n):
    """DP solution

    Starting from dp[i-1], compute dp[i].

    """
    if n == 1:
        return 1 if A[0] == set([REST]) else 0

    best = {REST: 1, CONTEST: 0, GYM: 0}

    for i in range(n-1):
        new_best = {REST: 1e100, CONTEST: 1e100, GYM: 1e100}
        for activity in A[i]: # *only* use activities which are legal for today for computing paths for tomorrow
            for tomorrow_activity in A[i+1]:
                if activity == tomorrow_activity and activity in [CONTEST, GYM]:
                    continue

                tomorrow_rest = best[activity]
                tomorrow_rest += 1 if tomorrow_activity == REST else 0
                new_best[tomorrow_activity] = min(tomorrow_rest, new_best[tomorrow_activity])

        best = new_best

    return min(best.values())

if __name__ == '__main__':
    n = int(raw_input())
    A = [int(num) for num in raw_input().split()]

    REST, CONTEST, GYM = range(3)
    N = {0: 'REST', 1: 'CONTEST', 2: 'GYM'}
    D = {0: {REST},
         1: {CONTEST, REST},
         2: {GYM, REST},
         3: {CONTEST, GYM, REST}}

    print dp_forward_solve(A=[D[a] for a in A], n=n)

    # print dp_backward_solve(A=[D[a] for a in A], n=n)

    # print bfs_solve(A=[D[a] for a in A], n=n)

    # print min_rest(T=n, A=[None]+[D[a] for a in A]) # one-indexed
