//当该点时p-position时,先手输
//当该点为n-position时,即a1^a2......^an = k时;
//先手的第一步是使得a1^a2^.......^an^k = 0;
//那么只要ai^k < ai就行
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std ;
const int maxn = 10000010 ;
int num[maxn] ;
int main()
{
// freopen("in.txt","r",stdin);
int n ;
while(scanf("%d",&n)&&n)
{
int sum = 0 ;
for(int i = 1;i <= n ;i++)
{
scanf("%d" ,&num[i]) ;
sum^=num[i] ;
}
if(sum == 0)
{
printf("0\n") ;
continue ;
}
int ans = 0 ;
for(int i = 1;i <= n ;i++)
{
int t = num[i]^sum ;
if(t < num[i])
ans++ ;
}
printf("%d\n",ans );
}
return 0;
}
时间: 2024-11-05 10:22:06