#include <bits/stdc++.h>
using namespace std;
string convertstring(long long n) {
  stringstream ss;
  ss << n;
  return ss.str();
}
const int N = 200002;
int a[N];
int main() {
  int n;
  int i;
  cin >> n;
  for (i = (int)0; i < (int)n; i++) cin >> a[i];
  int ok = 0;
  for (i = (int)0; i < (int)n; i++) {
    int actual = a[i] - ok;
    if (actual < 0) {
      printf("NO\n");
      return 0;
    }
    if (actual % 2 == 0) {
      ok = 0;
    } else {
      ok = 1;
    }
  }
  if (ok == 1) {
    printf("NO\n");
    return 0;
  }
  printf("YES\n");
  return 0;
}
