#include<bits/stdc++.h>
using namespace std;
int n,a[100010],cnt=0;
int main(){
ios::sync_with_stdio(0);
cin.tie(0),cout.tie(0);
cin>>n;
for(int i=1;i<=n;i++){
cin>>a[i];
}
int tnt=0;
for(int i=1;i<=n;i++){
if(a[i]==1){
cnt++;
}else if(a[i]==2){
for(int j=i-1;j>=1;j--){
if(a[j]==1){
tnt++;
}
}
if(tnt>=1){
tnt=0;
continue;
}else{
cnt=0;
cnt++;
tnt=0;
}
}else if(a[i]==3){
for(int j=i+1;j<=n;j++){
if(a[j]==1){
tnt++;
}wwwww
}
if(tnt>=1){
tnt=0;
continue;
}else{
cnt++;
tnt=0;
break;
}
}
}
cout<<cnt;
return 0;
}