#include <bits/stdc++.h>
using namespace std;
int n;
int a[200005];
int main() {
  int t1, t2;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  bool cup = false, pos = true;
  for (int i = 0; i < n; i++) {
    if (a[i] == 0) {
      if (cup == true) {
        pos = false;
        break;
      }
    } else if (a[i] % 2 == 1) {
      cup = !cup;
    }
  }
  if (cup == true) {
    pos = false;
  }
  if (pos == true)
    cout << "YES\n";
  else
    cout << "NO\n";
  return 0;
}
