#include <bits/stdc++.h>
using namespace std;
const int N = 200000 + 1067;
int a[N];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  int nho = 0;
  for (int i = 1; i <= n; i++) {
    a[i] -= nho;
    nho = 0;
    if (a[i] < 0) {
      cout << "NO" << endl;
      return 0;
    }
    a[i] %= 2;
    nho = a[i];
  }
  if (nho > 0)
    cout << "NO" << endl;
  else
    cout << "YES" << endl;
  return 0;
}
