#include <bits/stdc++.h>
using namespace std;
const int N = 200010;
int n, a[N];
inline void print(int x) {
  if (x)
    printf("YES\n");
  else
    printf("NO\n");
  exit(0);
}
int main() {
  scanf("%d", &n);
  int i, x = 0;
  for (i = 1; i <= n; ++i) scanf("%d", &a[i]);
  for (i = 1; i <= n; ++i)
    if (a[i] & 1)
      a[i] = 1;
    else
      a[i] = min(a[i], 2);
  for (i = 1; i <= n; ++i) {
    if (!a[i] && x) print(0);
    a[i] -= x;
    if (a[i] == 2)
      x = 0;
    else
      x = a[i];
  }
  if (x) print(0);
  print(1);
  return 0;
}
