#include <bits/stdc++.h>
using namespace std;
const int N = 200010;
const int inf = 0x7f7f7f7f;
const int mod = 1000000007;
int a[N];
int n;
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", a + i);
    if (a[i] > 2) {
      a[i] %= 2;
      if (a[i] == 0) a[i] = 2;
    }
  }
  bool f = 0;
  for (int i = 0; i < n - 1; i++) {
    if (a[i] == 1) {
      a[i]--;
      a[i + 1]--;
    } else if (a[i] == 2) {
      a[i] -= 2;
    }
    if (a[i] < 0) {
      f = 1;
      break;
    }
  }
  if (a[n - 1] == 1 || a[n - 1] < 0) f = 1;
  if (f)
    cout << "NO" << endl;
  else
    cout << "YES" << endl;
}
