#include <bits/stdc++.h>
using namespace std;
long long ara[300000], m, n, x, y, z;
int main() {
  cin >> n;
  for (long long i = 1; i <= n; i++) cin >> ara[i];
  long long prvoff = -1;
  for (long long i = 1; i <= n; i++) {
    if (prvoff == -1) {
      long long tmp = ara[i];
      tmp = tmp % 2;
      if (tmp == 0) continue;
      prvoff = 1;
    } else {
      if (ara[i] == 0) {
        cout << "NO" << endl;
        return 0;
      }
      long long tmp = ara[i] - 1;
      tmp = tmp % 2;
      if (tmp == 1) continue;
      prvoff = -1;
    }
  }
  if (prvoff == 1)
    cout << "NO" << endl;
  else
    cout << "YES" << endl;
  return 0;
}
