#include <bits/stdc++.h>
using namespace std;
const int mxn = 2e5 + 100;
int a[mxn], b[mxn];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", a + i);
    if (a[i] > 0) a[i] = a[i] & 1 ? 1 : 2;
  }
  int sum = 0;
  bool ok = 1;
  for (int i = 0; i < n; i++) {
    if (a[i] == 0) {
      if (sum & 1) ok = 0;
      sum = 0;
    } else {
      sum += a[i];
    }
  }
  if (sum & 1) ok = 0;
  if (ok)
    puts("YES");
  else
    puts("NO");
  return 0;
}
