传送门
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define re register
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define P pair<int,int>
const int N=1e4;
const int mod=1e9+7;
void read(int &a)
{
a=0;
int d=1;
char ch;
while(ch=getchar(),ch>'9'||ch<'0')
if(ch=='-')
d=-1;
a=ch-'0';
while(ch=getchar(),ch>='0'&&ch<='9')
a=a*10+ch-'0';
a*=d;
}
void write(int x)
{
if(x<0)
putchar(45),x=-x;
if(x>9)
write(x/10);
putchar(x%10+'0');
}
int a[25];
int main()
{
int n;
read(n);
int cur;
for(re int i=1;i<=n;i++)
read(a[i]);
int t1=0,t2=0;
for(re int i=1;i<=n;i++)
{
if(a[i]==0)
break;
t1++;
}
for(re int i=n;i>=1;i--)
{
if(a[i]==0)
break;
t2++;
}
if(t1&1||t2&1)
puts("YES");
else
puts("NO");
return 0;
}