#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10;
int a[N];
int main() {
  int n;
  while (scanf("%d", &n) == 1) {
    for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
    bool f = 1;
    for (int i = 1; i <= n; i++) {
      a[i] -= 2 * (int)(a[i] / 2);
      if (i < n && a[i] > 0) {
        if (a[i + 1] >= a[i]) {
          a[i + 1] -= a[i];
          a[i] = 0;
        } else {
          f = 0;
          break;
        }
      }
      if (a[i] > 0) {
        f = 0;
        break;
      }
    }
    if (f)
      puts("YES");
    else
      puts("NO");
  }
  return 0;
}
