#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
int INF=1e9;
int main() {
    long long b, n, ans = 0, f = 0, x, k3 = 0;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
        if (i > 0 && a[i] == 2 && a[i - 1] == 3)
            a[i - 1] = 1;
    }
    for (int i = 0; i < n; ++i) {
        if (f == 0) {
            f = a[i] % 3;
            ++ans;
        } else if (a[i] != f) {
            if (f == 2) {
                f = 0;
            } else {
                f = 2;
                ++ans;
            }
        }
    }
    cout << ans;
}
