#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, i, carry = 0, flag = 1;
  cin >> n;
  int ar[n];
  for (i = 0; i < n; i++) {
    cin >> ar[i];
    if (ar[i] == 0 && carry == 1) {
      flag = 0;
    }
    if (ar[i] % 2 == 0 && carry == 0) {
      continue;
    }
    if (i == (n - 1)) {
      if (ar[i] % 2 == 0 && carry == 1) {
        cout << "NO\n";
        return 0;
      }
      if (ar[i] % 2 == 1 && carry == 0) {
        cout << "NO\n";
        return 0;
      }
    }
    if (ar[i] % 2 == 1 && carry == 1) {
      carry = 0;
      continue;
    }
    carry = 1;
  }
  if (flag == 0) {
    cout << "NO\n";
    return 0;
  }
  cout << "YES\n";
  return 0;
}
