#include <bits/stdc++.h>
using namespace std;
bool comp(long long a, long long b) { return (a < b); }
void solve();
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(0);
  int t = 1;
  while (t--) {
    solve();
  }
  cerr << "time taken : " << (float)clock() / CLOCKS_PER_SEC << " secs"
       << "\n";
  return 0;
}
void solve() {
  int n;
  cin >> n;
  vector<int> v(n);
  for (int i = 0; i < n; i++) {
    cin >> v[i];
  }
  int ans = 0, recent = 0, option = -5;
  for (int i = 0; i < n; i++) {
    if (v[i] == 0) {
      ans++;
      recent = 0;
    } else if (v[i] == 2) {
      if (recent == 2) {
        if (i - option == 1) {
          option = -5;
          recent = 2;
        } else {
          ans++;
          recent = 0;
        }
      } else {
        recent = 2;
      }
    } else if (v[i] == 3) {
      if (recent == 1) {
        recent = 2;
      } else if (recent == 2) {
        recent = 1;
      } else {
        option = i;
      }
    } else if (v[i] == 1) {
      if (recent == 1) {
        if (i - option == 1) {
          option = -6;
          recent = 1;
        } else {
          ans++;
          recent = 0;
        }
      } else {
        recent = 1;
      }
    }
  }
  cout << ans;
}
