#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, i, j, k, s1 = 0, s2 = 0;
  cin >> n;
  vector<int> a(n), b;
  set<int> c;
  for (i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (i = 0; i < n; i++) {
    if (a[i] % 2 == 0 && a[i] > 0)
      continue;
    else if (a[i] % 2) {
      if (i == n - 1)
        break;
      else if (a[i + 1] == 0)
        break;
      else
        a[i + 1]--;
    }
  }
  if (i == n)
    cout << "YES";
  else
    cout << "NO";
  return 0;
}
