Be the Winner


Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 2177    Accepted Submission(s): 1180


Problem Description


Let's consider m apples divided into n groups. Each group contains no more than 100 apples, arranged in a line. You can take any number of consecutive apples at one time.
For example "@@@" can be turned into "@@" or "@" or "@ @"(two piles). two people get apples one after another and the one who takes the last is
the loser. Fra wants to know in which situations he can win by playing strategies (that is, no matter what action the rival takes, fra will win).


 


Input


You will be given several cases. Each test case begins with a single number n (1 <= n <= 100), followed by a line with n numbers, the number of apples in each pile. There is a blank line between cases.



Output


If a winning strategies can be found, print a single line with "Yes", otherwise print "No".


 


Sample Input


2 2 2 1 3


 


Sample Output


No Yes


/*
2509 nim博弈
给定n堆苹果,每次任意取一堆中的n个,最先取完者败
判断先手输赢。

同1907
对于N堆的糖,一种情况下是每堆都是1,那么谁输谁赢看堆数就知道;
对于不都是1的话,若这些堆是奇异局势,或说他们是非奇异局势,但非奇异局势皆可以转换到奇异局势。

经典的尼姆问题是谁哪拿到最后一个则谁赢,本题是拿最后一个的输。
下面分析第二种情况:
1.初始给的是奇异局势的话,则先取者拿到最后一个为输。
2.初始给的是非奇异局势的话,则先取者为赢。
对于任何奇异局势(a,b,c),都有a^b^c=0(^是代表异或).
非奇异局势(a,b,c)(a<b<c)转换为奇异局势,只需将c变成a^b,即从c中减去c-(a^b)即可
*/
#include<iostream>
#include<stdio.h>
using namespace std;
int main()
{
int i,n,a[101],ans,f;

while(scanf("%d",&n)!=EOF)
{
f=0;
ans=0;
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
ans^=a[i];
if(a[i]>1)
f=1;
}
if(f==0)//都是1
{
if(n%2==0)
printf("Yes\n");
else
printf("No\n");
}
else
{
if(ans==0)//奇局势
printf("No\n");
else
printf("Yes\n");
}
}
return 0;
}