#include <bits/stdc++.h>
using namespace std;
int n, a[200001];
int main() {
  while (scanf("%d", &n) == 1) {
    memset(a, 0, sizeof a);
    for (int i = 0; i < n; ++i) scanf("%d", &a[i]);
    bool flag = true;
    for (int i = 0; i < n; ++i) {
      if (!a[i]) continue;
      a[i] %= 2;
      a[i + 1] -= a[i];
      if (a[i + 1] < 0) {
        flag = false;
        break;
      }
    }
    if (flag)
      puts("YES");
    else
      puts("NO");
  }
  return 0;
}
