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