#include <bits/stdc++.h>   using namespace std;   int main() {     int n;     cin >> n;     vector<int> a(n);     for (int i = 0; i < n; i++) cin >> a[i];     int pen = 0;     for (int i = 0; i < n; i++) {       if (pen) {         if (a[i])           a[i]--;         else {           cout <<  NO ;           return 0;         }         pen = 0;       }       if (a[i] % 2) pen = 1;       if (i == n - 1) {         if (pen)           cout <<  NO ;         else           cout <<  YES ;       }     }     return 0;   }   