# 题意

$n,{a}_{i}\le 5\ast {10}^{5}$$n,a_i\le 5*10^5$

# 代码

#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>

const int N=1048591;
const int MOD=10007;
const int ny2=(MOD+1)/2;

int n,a[N],po[23][N],bin[23];

void FWT(int *a,int l,int r)
{
if (l==r) return;
int len=(r-l+1)/2,mid=(l+r)/2;
FWT(a,l,mid);FWT(a,mid+1,r);
for (int i=0;i<len;i++)
{
int u=a[l+i],v=a[l+len+i];
a[l+i]=u+v;a[l+i]-=a[l+i]>=MOD?MOD:0;
a[l+len+i]=u+MOD-v;a[l+len+i]-=a[l+len+i]>=MOD?MOD:0;
}
}

void DWT(int *a,int l,int r)
{
if (l==r) return;
int len=(r-l+1)/2,mid=(l+r)/2;
DWT(a,l,mid);DWT(a,mid+1,r);
for (int i=0;i<len;i++)
{
int u=a[l+i],v=a[l+len+i];
a[l+i]=(u+v)*ny2%MOD;a[l+len+i]=(u+MOD-v)*ny2%MOD;
}
}

int main()
{
bin[0]=1;
for (int i=1;i<=20;i++) bin[i]=bin[i-1]*2;
scanf("%d",&n);int w=0;
for (int i=1;i<=n;i++)
{
int x;scanf("%d",&x);
a[x]=1;w^=x;
}
a[0]=1;
if (!w) {printf("%d\n",n);return 0;}
FWT(a,0,bin[20]-1);
for (int i=0;i<bin[20];i++) po[0][i]=1;
for (int j=1;j<=20;j++)
for (int i=0;i<bin[20];i++) po[j][i]=po[j-1][i]*a[i]%MOD;
int l=1,r=20;
while (l<=r)
{
int mid=(l+r)/2;
DWT(po[mid],0,bin[20]-1);
if (po[mid][w]) r=mid-1;
else l=mid+1;
}
if (r==20) puts("0");
else printf("%d\n",n-(r+1));
return 0;
}