#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, i, j = 0, k = 0, arr[200009];
  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    scanf("%d", &arr[i]);
    if (arr[i] == 0)
      arr[i] = 0;
    else if (arr[i] % 2 == 0 && arr[i] > 0)
      arr[i] = 2;
    else
      arr[i] = 1;
  }
  while (j < n) {
    if (arr[j] == 2 || arr[j] == 0)
      j++;
    else if (arr[j] == 1 && arr[j + 1] >= 1 && j + 1 < n)
      arr[j + 1]--, j++;
    else
      break;
  }
  if (j < n)
    cout << "NO";
  else
    cout << "YES";
}
