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