#include <bits/stdc++.h>
const long double ACOSPI = (acosl(-1.0));
using namespace std;
int main() {
  int prev = 0, curr = 0;
  int parity = 0;
  int n = 0;
  int i = 0;
  cin >> n;
  if (n == 1) {
    cin >> curr;
    if (curr & 1) {
      cout << "NO";
    } else {
      cout << "YES";
    }
    return 0;
  }
  cin >> curr;
  parity = curr & 1;
  for (i = 1; i < n; i++) {
    cin >> curr;
    if (parity == 1) {
      if (curr % 2 == 0) {
        if (curr == 0) {
          cout << "NO";
          return 0;
        } else {
          parity = 1;
        }
      } else {
        if (curr == 0) {
          cout << "NO";
          return 0;
        } else {
          parity = 0;
        }
      }
    } else {
      parity = curr & 1;
    }
  }
  if (parity) {
    cout << "NO";
    return 0;
  }
  cout << "YES";
  return 0;
}
