#include <bits/stdc++.h>
using namespace std;
int main() {
  long n;
  cin >> n;
  long long sum = 0;
  int x[200000];
  int flag = 0;
  for (long i = 0; i < n; i++) {
    cin >> x[i];
    sum += x[i];
    if (x[i] == 0 && sum % 2 == 1) {
      flag = 1;
      sum = 0;
    }
  }
  if (sum % 2 == 1) flag = 1;
  if (flag == 1)
    cout << "NO";
  else
    cout << "YES";
}
