#include <bits/stdc++.h>
using namespace std;
int c[9999999];
int main() {
  long long a, b, w = 0, i, q = 1;
  cin >> a;
  for (i = 0; i < a; ++i) {
    cin >> c[i];
  }
  if (a == 3 && c[0] == 1 || a == 6 && c[0] == 2) {
    cout << "Yes";
    return 0;
  }
  for (i = 0; i < a - 1; ++i) {
    if ((c[i] * c[i + 1] % 4) != 0) {
      swap(c[i], c[i + 1]);
      if ((c[i] * c[i + 1] % 4) != 0) {
        cout << "No";
        return 0;
      }
    }
  }
  cout << "Yes";
}
