#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long n;
  cin >> n;
  long long a[n + 1];
  list<long long> b;
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
    if (b.size() == 0)
      b.push_front(a[i]);
    else if (b.front() % 2 == a[i] % 2)
      b.pop_front();
    else
      b.push_front(a[i]);
  }
  if (b.size() <= 1)
    cout << "Yes\n";
  else
    cout << "No\n";
  return 0;
}
