#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, f = 0;
  vector<int> v;
  cin >> n;
  for (int i = 0; i < n; i++) {
    int p;
    cin >> p;
    v.push_back(p);
  }
  for (int i = 0; i < n; i++) {
    if (v[i] == 0)
      continue;
    else if (v[i] % 2 == 0)
      continue;
    else {
      if (i == n - 1 || v[i + 1] < 1) {
        f = 1;
        break;
      }
      v[i + 1]--;
    }
  }
  if (f == 0)
    cout << "YES";
  else
    cout << "NO";
}
