#include <iostream>
using namespace std;
int main()
{
    int n, ans = 0, k = 0, a[21] = { 0 };
    cin >> n;
    for (int i = 1; i <= n; i++) {
        cin >> a[i];
    }
    for(int i=1;i<=n;i++){
        if(a[i]==0){
            if(i%2==0){
                cout<<"YES";
                return 0;
            }
            break;
        }
    }
    for (int i = n; i >= 1; i--) {
        k=n-i+1;
        if (a[i] == 0) {
            if (k % 2 == 0) {
                cout<<"YES";
                return 0;
            }
            break;
        }
    }
    cout<<"NO";
}
