#include <bits/stdc++.h>
int a[200010];
int main(void) {
  int n, flag = 0;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }
  for (int i = 0; i < n; i++) {
    if (a[i] != 0) {
      if (a[i] % 2 != 0) flag++;
    }
    if (a[i] == 0 && flag % 2 != 0) {
      printf("NO\n");
      return 0;
    }
  }
  if (flag % 2 != 0) {
    printf("NO\n");
    return 0;
  }
  printf("YES\n");
  return 0;
}
