#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  scanf("%d", &n);
  int a[200005];
  int has[200005];
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    if (a[i])
      has[i] = 1;
    else
      has[i] = 0;
    a[i] %= 2;
  }
  int need = 0;
  ;
  for (int i = 0; i < n; i++) {
    if (a[i] == 1) {
      need ^= 1;
    } else {
      if (need && !has[i]) {
        printf("NO\n");
        return 0;
      }
    }
  }
  if (need)
    printf("NO\n");
  else
    printf("YES\n");
  return 0;
}
