# bzoj2844: albus就是要第一个出场

## Description

f(空集) = 0
f(T) = XOR A[t] , 对于一切t属于T

3
1 2 3
1

## Sample Output

3

【Hint】

N = 3, A = [1 2 3]
S = {1, 2, 3}
2^S = {空, {1}, {2}, {3}, {1, 2}, {1, 3}, {2, 3}, {1, 2, 3}}
f(空) = 0
f({1}) = 1
f({2}) = 2
f({3}) = 3
f({1, 2}) = 1 xor 2 = 3
f({1, 3}) = 1 xor 3 = 2
f({2, 3}) = 2 xor 3 = 1
f({1, 2, 3}) = 0

B = [0, 0, 1, 1, 2, 2, 3, 3]

## HINT

1 <= N <= 10,0000

code：
 1 #include<cstdio>
2 #include<iostream>
3 #include<cmath>
4 #include<cstring>
5 #include<algorithm>
6 #define maxn 100005
7 #define mod 10086
8 using namespace std;
9 char ch;
10 int n,m,q,a[maxn],ans;
11 bool ok;
13     for (ok=0,ch=getchar();!isdigit(ch);ch=getchar()) if (ch=='-') ok=1;
14     for (x=0;isdigit(ch);x=x*10+ch-'0',ch=getchar());
15     if (ok) x=-x;
16 }
17 void gauss(){
18     int i,j,k;
19     for (i=30,k=1;i>=0;i--){
20         for (j=k;j<=n&&!(a[j]&(1<<i));j++);
21         if (j<=n){
22             swap(a[k],a[j]);
23             for (j=1;j<=n;j++) if (j!=k&&(a[j]&(1<<i))) a[j]^=a[k];
24             k++;
25         }
26     }
27     m=k-1;
28 }
29 int ksm(int a,int b){
30     int t=1;
31     for (;b;b>>=1){if (b&1) t=t*a%mod; a=a*a%mod;}
32     return t;
33 }
34 int main(){
37     gauss();
46 }