n = int(input())
arr = [int(i) for i in input().split()]
count = 0
last = 'n'
for i in range(n):
if arr[i] == 0:
count +=1
last = 'n'
elif arr[i] == 1:
if last != 'c':
last = 'c'
else:
last = 'n'
count += 1
elif arr[i] == 2:
if last != 'g':
last = 'g'
else:
last = 'n'
count += 1
else:
if last == 'c':
last= 'g'
elif last == 'g':
last = 'c'
else:
last = 'n'
print(count)
#include <bits/stdc++.h>
#define fo(i, n) for(int i = 0; i < n; i++)
#define srt(arr) sort(arr.begin(),arr.end())
#define pb push_back
using namespace std;
#define ll long long
void mom(){
int n;
cin>>n;
vector<int>a(n);
for(int i=0;i<n;i++){
cin>>a[i];
}
int maxy =0;
vector<vector<int>>dp(n+1,vector<int>(3,0));
for(int i=1;i<=n;i++){
dp[i][0]= maxy;dp[i][1]= maxy; dp[i][2] = maxy;
if(a[i-1]==1 or a[i-1]==3){
dp[i][1] = max(dp[i-1][0],dp[i-1][2])+1;
maxy = max(dp[i][1],maxy);
}
if(a[i-1]==2 or a[i-1]==3){
dp[i][2] = max(dp[i-1][0],dp[i-1][1])+1;
maxy = max(dp[i][2],maxy);
}
}
cout<<n - maxy<<endl;
}
signed main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int T;
T=1;
//cin>>T;
while(T--){
mom();
}
return 0;
}
1278B - A and B | 1353D - Constructing the Array |
1269C - Long Beautiful Integer | 1076A - Minimizing the String |
913C - Party Lemonade | 1313A - Fast Food Restaurant |
681A - A Good Contest | 1585F - Non-equal Neighbours |
747A - Display Size | 285A - Slightly Decreasing Permutations |
515C - Drazil and Factorial | 1151E - Number of Components |
1151F - Sonya and Informatics | 556A - Case of the Zeros and Ones |
867A - Between the Offices | 1569A - Balanced Substring |
260A - Adding Digits | 1698C - 3SUM Closure |
1029B - Creating the Contest | 1421A - XORwice |
1029A - Many Equal Substrings | 1675D - Vertical Paths |
1271C - Shawarma Tent | 805A - Fake NP |
1163A - Eating Soup | 787A - The Monster |
807A - Is it rated | 1096A - Find Divisible |
1430C - Numbers on Whiteboard | 1697B - Promo |