#include <bits/stdc++.h>
template <typename T>
void Scan(T& t) {
  std::cin >> t;
}
template <typename First, typename... Rest>
void Scan(First& first, Rest&... rest) {
  std::cin >> first;
  Scan(rest...);
}
using ll = long long;
using ull = unsigned long long;
constexpr ll INFINT = 1 << 30;
constexpr ll INFINT_LIM = (1LL << 31) - 1;
constexpr ll INFLL = 1LL << 60;
constexpr double EPS = 1e-9;
constexpr ll MOD = 1000000007;
constexpr double PI = 3.141592653589793238;
signed main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  ;
  ll n;
  Scan(n);
  ;
  std::vector<ll> a(n);
  for (auto& i : a) std::cin >> i;
  ;
  for (ll i = 0; i < ll(n); ++i) {
    if (a[i] < 0) {
      std::cout << "NO";
      std::cout << "\n";
      ;
      return 0;
    }
    a[i] %= 2;
    if (a[i] == 0) continue;
    if (i == n - 1) continue;
    --a[i];
    --a[i + 1];
  }
  for (ll i = 0; i < ll(n); ++i) {
    if (a[i] != 0) {
      std::cout << "NO";
      std::cout << "\n";
      ;
      return 0;
    }
  }
  std::cout << "YES";
  std::cout << "\n";
  ;
  return 0;
}
