#include <bits/stdc++.h>
using namespace std;
int a[2000005];
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  int p = a[0] % 2;
  a[n] = 0;
  for (int i = 1; i <= n; i++) {
    if (p && a[i]) {
      a[i]--;
      p = a[i] % 2;
    } else if (p && !a[i]) {
      cout << "NO";
      return 0;
    } else if (!p && a[i]) {
      p = a[i] % 2;
    }
  }
  if (p)
    cout << "NO";
  else
    cout << "YES";
}
