#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  bool flag = true;
  cin >> n;
  int a[200000];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  bool odd = false;
  for (int i = 0; i < n; i++) {
    int t = a[i];
    if (odd && a[i] == 0) {
      cout << "NO" << endl;
      return 0;
    }
    if ((a[i] - (odd ? 1 : 0)) % 2) {
      odd = true;
    } else
      odd = false;
  }
  if (odd)
    cout << "NO" << endl;
  else
    cout << "YES" << endl;
  return 0;
}
