Killjee is playing with an array a, which has n integers. He is trying to encrypt this array as a single integer.
Let l be the largest number in array a. Then, the code for array a is ∑lj=0bj∗31j mod 109+7.
Here, bj is the size of largest subset of array a whose XOR is equal to j.If there exist no subset of array a whose XOR is j then bj=0.
INPUT CONSTRAINTS:
1≤n≤104
1≤ai≤103
INPUT FORMAT :
First line of input contains a single integer n. Next line contains n space separated integers, elements of array a.
OUTPUT FORMAT :
Print a single integer code of the array a.
Here, b[0]=3 as the subset (1,2,3) has xor value equal to 0.
b[1]=2, as the subset (2,3) has xor value equal to 1
b[2] = 2, as the subset (1,3) has xor value equal to 2
b[3]=2, as the subset (1,2) has xor value equal to 3
b[4] = 4, as the subset (1,2,3,4) has xor value equal to 4.
Thus, the answer = (b[0]×310)+(b[1]×311)+(b[2]×312)+(b[3]×313)+(b[4]×314) Modulo 109+7 = 3755653 .