#include <bits/stdc++.h>
using namespace std;
const double pi =
    3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342;
int dp[110][4], t[110];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < (n); ++i) scanf("%d", &t[i]);
  for (int i = 0; i < (t[0] + 1); ++i)
    if (t[0] & i)
      dp[0][i] = 0;
    else
      dp[0][i] = 110;
  dp[0][0] = 1;
  for (int i = (1); i < (n); ++i)
    for (int j = 0; j < (t[i] + 1); ++j) {
      dp[i][j] = 110;
      if ((t[i] & j) || !j) {
        for (int k = 0; k < (t[i - 1] + 1); ++k) {
          if (!j)
            dp[i][j] = min(dp[i][j], dp[i - 1][k] + 1);
          else if ((j & k) == 0)
            dp[i][j] = min(dp[i][j], dp[i - 1][k]);
        }
      }
    }
  int res = 110;
  for (int i = 0; i < (t[n - 1] + 1); ++i) res = min(res, dp[n - 1][i]);
  printf("%d\n", res);
  return 0;
}
