#include <bits/stdc++.h>
using namespace std;
int n, a, b, c;
vector<int> v;
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n;
  v.resize(n);
  for (int i = 0; i < n; ++i) {
    cin >> v[i];
    --v[i];
  }
  a = 0;
  b = 1;
  c = 2;
  for (int i = 0; i < n; ++i) {
    int x = v[i];
    if (x == c) {
      cout << "NO" << endl;
      return 0;
    }
    if (b == x) swap(a, b);
    swap(b, c);
  }
  cout << "YES" << endl;
  return 0;
  return 0;
}
