#include <bits/stdc++.h>
using namespace std;
inline int bsearch(int sm[], int c, int r) {
  int l = 0, m;
  while (l <= r) {
    m = (l + r) / 2;
    if (sm[m] < c)
      l = m + 1;
    else if (sm[m] > c)
      r = m - 1;
    else
      return m + 1;
  }
  if (c > sm[m]) return m + 2;
  return m + 1;
}
inline int mn(int a, int b) { return a < b ? a : b; }
int main() {
  std::ios::sync_with_stdio(false);
  int i, n, g, r, c, g1, r1, c1, t;
  cin >> n;
  cin >> t;
  if (t == 0) {
    r = 1;
    g = 2;
    c = 2;
  } else if (t == 1) {
    r = 1;
    g = 2;
    c = 0;
  } else if (t == 2) {
    r = 1;
    g = 0;
    c = 2;
  } else {
    r = 1;
    g = 0;
    c = 0;
  }
  int tg = 1;
  for (i = 1; i < n; i++) {
    cin >> t;
    switch (t) {
      case 0:
        if (tg) {
          r1 = 1 + mn(r, mn(g, c));
          g1 = r1 + 1;
          c1 = r1 + 1;
        } else {
          r = 1 + mn(r1, mn(g1, c1));
          g = r + 1;
          c = r + 1;
        }
        break;
      case 1:
        if (tg) {
          r1 = 1 + mn(r, mn(g, c));
          g1 = r1 + 1;
          c1 = mn(r, g);
        } else {
          r = 1 + mn(r1, mn(g1, c1));
          g = r + 1;
          c = mn(r1, g1);
        }
        break;
      case 2:
        if (tg) {
          r1 = 1 + mn(r, mn(g, c));
          g1 = mn(r, c);
          c1 = r1 + 1;
        } else {
          r = 1 + mn(r1, mn(g1, c1));
          g = mn(r1, c1);
          c = r + 1;
        }
        break;
      default:
        if (tg) {
          r1 = 1 + mn(r, mn(g, c));
          g1 = mn(r, c);
          c1 = mn(r, g);
        } else {
          r = 1 + mn(r1, mn(g1, c1));
          g = mn(r1, c1);
          c = mn(r1, g1);
        }
    }
    tg = 1 - tg;
  }
  if (tg)
    cout << mn(r, mn(g, c));
  else
    cout << mn(r1, mn(g1, c1));
  return 0;
}
