#include <bits/stdc++.h>   using namespace std;   int main() {     bool discount_flag = true;     int num_of_session;     cin >> num_of_session;     vector<int> num_of_teams(200001);     for (int i = 0; i < num_of_session; i++) cin >> num_of_teams[i];     for (int i = 0; i < num_of_session; i++)       if (num_of_teams[i] % 2 == 1)         if (i != num_of_session - 1 and num_of_teams[i + 1] > 0) {           num_of_teams[i + 1] -= 1;           num_of_teams[i] = 0;         } else if (num_of_teams[i + 1] == 0)           discount_flag = false;         else if (i == num_of_session)           discount_flag = false;     if (discount_flag)       cout <<  YES  << endl;     else       cout <<  NO  << endl;     return 0;   }   