#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  bool res = true;
  int coupon = 0;
  int prev = 0;
  for (int i = 0; i < n; i++) {
    int tmp;
    cin >> tmp;
    if (coupon > tmp) {
      res = false;
      break;
    }
    tmp -= coupon;
    coupon = 0;
    if (tmp % 2 == 1) coupon++;
  }
  if (coupon) res = false;
  if (res)
    cout << "YES";
  else
    cout << "NO";
}
