#include <bits/stdc++.h>
using namespace std;
long long power(long long a, long long b) {
  if (b == 0) return 1;
  if (b % 2 == 0) return power(a * a % 1000000007, b / 2);
  return a * power(a, b - 1) % 1000000007;
}
long long gcd(long long a, long long b) {
  if (a == 0) return b;
  return gcd(b % a, a);
}
int a[200000];
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n - 1; i++) {
    if (a[i] < 0) {
      cout << "NO";
      return 0;
    }
    int z = min(a[i], a[i + 1]);
    while ((a[i] - z) % 2 == 1 && z > 0) {
      a[i] -= 2;
      z = min(a[i], a[i + 1]);
    }
    a[i] -= z;
    a[i + 1] -= z;
    if (a[i] % 2 == 1) {
      cout << "NO";
      return 0;
    }
  }
  if (a[n - 1] % 2 == 1) {
    cout << "NO";
    return 0;
  }
  cout << "YES";
  return 0;
}
