#include <bits/stdc++.h>
using namespace std;
int a[200002], i, j, k, n, m, x, y, t;
int main() {
  scanf("%d", &n);
  for (i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    if (a[i] & 1)
      a[i] = 1;
    else if (a[i] > 0)
      a[i] = 2;
  }
  for (i = 1; i <= n; i++)
    if (a[i] == 1) {
      if (a[i + 1] == 0) {
        printf("NO\n");
        return 0;
      } else
        a[i]--, a[i + 1]--;
    } else
      a[i] = 0;
  printf("YES\n");
  return 0;
}
