#include <bits/stdc++.h>
using namespace std;
const int oo = 1e9;
const int inf = 0x3f3f3f3f;
const long long OO = 1e18;
const long long INF = 0x3f3f3f3f3f3f3f3f;
const double pi = acos(-1);
const double e = 2.718281828459045;
const double eps = 1e-8;
int main(int argc, char* argv[]) {
  int n;
  cin >> n;
  bool flag = n & 1;
  int cnt = 0;
  while (n--) {
    int a;
    cin >> a;
    if (n & 1)
      a & 1 ? ++cnt : --cnt;
    else
      a & 1 ? --cnt : ++cnt;
  }
  bool res = !cnt;
  if (flag) res = abs(cnt) < 2;
  cout << (res ? "YES" : "NO") << endl;
  return 0;
}
