#include <bits/stdc++.h>
using namespace std;
int n;
int in[200000];
int main() {
  cin >> n;
  bool ok = true;
  int current = 0;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    if (x == 0) {
      if (current % 2 == 1) {
        ok = false;
        break;
      } else
        current = 0;
    }
    current += x;
  }
  if (current % 2 == 1) ok = false;
  if (ok)
    cout << "YES\n";
  else
    cout << "NO\n";
  return 0;
}
