#include <bits/stdc++.h>
using namespace std;
const int MAX = (int)1e5 + 6;
const int inf = (int)1e9 * 2;
const int mod = (int)1e9 + 7;
const double pi = 3.141592653589;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n, i, a[200005], x;
  cin >> n;
  for (i = 0; i < n; i++) cin >> a[i];
  for (i = 0; i < n; i++) {
    if (a[i] % 2 != 0 && a[i + 1] == 0) {
      cout << "NO";
      break;
    } else if (a[i] % 2 != 0)
      a[i + 1] -= 1;
    else
      a[i] = 0;
  }
  if (i == n) {
    if (a[n - 1] == 0)
      cout << "YES";
    else
      cout << "NO";
  }
  return 0;
}
