#include <bits/stdc++.h>

using namespace std;

/*
   let dp[i][j] be the minimum number of R's appering in a sequence
   of length i with the last character beeing j

   0 -> R
   1 -> C
   2 -> G
*/
int main(){
   int n; cin >> n;
   vector<int> A(n + 1);
   for (int i = 1; i <= n; i++) {
      cin >> A[i];
   }

   vector<vector<int>> dp(n + 1, vector<int>(3, 0));
   for (int i = 1; i <= n; i++) {
      int cur = A[i];
      dp[i][0] = min({dp[i - 1][0], dp[i - 1][1], dp[i - 1][2]}) + 1;
      if (cur == 0) {
         dp[i][1] = INT_MAX;
         dp[i][2] = INT_MAX;
      } else if (cur == 1) {
         dp[i][1] = min(dp[i - 1][0], dp[i - 1][2]);
         dp[i][2] = INT_MAX;
      } else if (cur == 2) {
         dp[i][1] = INT_MAX;
         dp[i][2] = min(dp[i - 1][0], dp[i - 1][1]);
      } else {
         dp[i][1] = min(dp[i - 1][0], dp[i - 1][2]);
         dp[i][2] = min(dp[i - 1][0], dp[i - 1][1]);
      }
   }

   cout << min({dp[n][0], dp[n][1], dp[n][2]}) << endl;

   return 0;
}