#include <bits/stdc++.h>
int main() {
  std::ios_base::sync_with_stdio(false);
  int n;
  std::cin >> n;
  bool coupon = false;
  while (n--) {
    int a;
    std::cin >> a;
    if (a == 0 && coupon) {
      std::cout << "NO" << std::endl;
      return 0;
    }
    if (coupon) --a;
    coupon = a % 2 != 0;
  }
  std::cout << (coupon ? "NO" : "YES") << std::endl;
  return 0;
}
