a[5001],i,s,p;main(j){for(gets(&j);~scanf("%d",++i+a););for(;j=--i;p&&s++)for(p=a[i];--j;)a[j]&(p^p-1)+1>>1?a[j]^=p:0;i=!printf("%d",1<