思路:
//By SiriusRen
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
const int inf=0x7fffffff,mod=10086;
int n,a[100050],q,flag=1,rec[66],ans;
void Gauss(){
for(int i=30,j;~i;i--){
for(j=flag;j<=n;j++)if(a[j]&(1<<i))break;
if(j==n+1)continue;
swap(a[j],a[flag]);
for(int k=1;k<=n;k++)
if(k!=flag&&(a[k]&(1<<i)))a[k]^=a[flag];
rec[i]=flag++;
}
}
int pow(int x,int y){
int w=1;
while(y){
if(y&1)w=w*x%mod;
x=(x*x)%mod;
y>>=1;
}return w;
}
int main(){
scanf("%d",&n);
for(int i=1;i<=n;i++)scanf("%d",&a[i]);
scanf("%d",&q);
Gauss();
for(int i=30;~i;i--)
if(rec[i]&&(q&(1<<i)))q^=a[rec[i]],ans=(ans+pow(2,n-rec[i]))%mod;
printf("%d
",(ans+1)%mod);
}