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