#include <bits/stdc++.h>
using namespace std;
int scan_d() {
  int ip = getchar(), ret = 0, flag = 1;
  for (; ip < '0' || ip > '9'; ip = getchar())
    if (ip == '-') {
      flag = -1;
      ip = getchar();
      break;
    }
  for (; ip >= '0' && ip <= '9'; ip = getchar()) ret = ret * 10 + ip - '0';
  return flag * ret;
}
long scan_ld() {
  int ip = getchar(), flag = 1;
  long ret = 0;
  for (; ip < '0' || ip > '9'; ip = getchar())
    if (ip == '-') {
      flag = -1;
      ip = getchar();
      break;
    }
  for (; ip >= '0' && ip <= '9'; ip = getchar()) ret = ret * 10 + ip - '0';
  return flag * ret;
}
long long scan_lld() {
  int ip = getchar(), flag = 1;
  long long ret = 0;
  for (; ip < '0' || ip > '9'; ip = getchar())
    if (ip == '-') {
      flag = -1;
      ip = getchar();
      break;
    }
  for (; ip >= '0' && ip <= '9'; ip = getchar()) ret = ret * 10 + ip - '0';
  return flag * ret;
}
long long unsigned scan_llu() {
  int ip = getchar();
  long long unsigned ret = 0;
  for (; ip < '0' || ip > '9'; ip = getchar())
    ;
  for (; ip >= '0' && ip <= '9'; ip = getchar()) ret = ret * 10 + ip - '0';
  return ret;
}
void print_d(int n, char sp) {
  if (n < 0) {
    n = -n;
    putchar('-');
  }
  int i = 10;
  char output_buffer[11];
  output_buffer[10] = sp;
  do {
    output_buffer[--i] = (n % 10) + '0';
    n /= 10;
  } while (n);
  do {
    putchar(output_buffer[i]);
  } while (++i < 11);
}
void print_ld(long n, char sp) {
  if (n < 0) {
    n = -n;
    putchar('-');
  }
  int i = 11;
  char output_buffer[12];
  output_buffer[11] = sp;
  do {
    output_buffer[--i] = (n % 10) + '0';
    n /= 10;
  } while (n);
  do {
    putchar(output_buffer[i]);
  } while (++i < 12);
}
void print_lld(long long n, char sp) {
  if (n < 0) {
    n = -n;
    putchar('-');
  }
  int i = 21;
  char output_buffer[22];
  output_buffer[21] = sp;
  do {
    output_buffer[--i] = (n % 10) + '0';
    n /= 10;
  } while (n);
  do {
    putchar(output_buffer[i]);
  } while (++i < 22);
}
void print_llu(long long unsigned n, char sp) {
  int i = 21;
  char output_buffer[22];
  output_buffer[21] = sp;
  do {
    output_buffer[--i] = (n % 10) + '0';
    n /= 10;
  } while (n);
  do {
    putchar(output_buffer[i]);
  } while (++i < 22);
}
long long fast_exp(int base, int exp) {
  long long res = 1;
  while (exp > 0) {
    if (exp % 2 == 1) res = (res * base) % 1000000007;
    base = (base * base) % 1000000007;
    exp /= 2;
  }
  return res % 1000000007;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, sum = 0;
  cin >> n;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    if (x == 0) {
      if (sum % 2 != 0) {
        cout << "NO" << '\n';
        return 0;
      }
      sum = 0;
    }
    sum += x;
  }
  if (sum % 2 == 0)
    cout << "YES" << '\n';
  else
    cout << "NO" << '\n';
}
