

Time Limit: 2 sec / Memory Limit: 1024 MB
配点 : 点
問題文
長さ の整数列 があります。
次の条件を満たす整数 , ( ) の組の個数を求めてください。
xorの説明
整数 の は以下のように定義されます。
- の値を とおく。 を 進数表記したときの ( , は整数 ) の位の値は、 のうち、 進数表記したときの の位の値が となるものが奇数個ならば 、偶数個ならば となる。
例えば、 と の の値は、 の 進数表記が 、 の 進数表記が のため、 進数表記が の となります。
制約
- 入力はすべて整数である
入力
入力は以下の形式で標準入力から与えられる。
出力
条件を満たす整数 , ( ) の組の個数を出力せよ。
入力例 1Copy
4 2 5 4 6
出力例 1Copy
5
明らかに、 は条件を満たします。 また、 の場合、 となるので、これも条件を満たします。 ほかに条件を満たす組はないので、答えは になります。
入力例 2Copy
9 0 0 0 0 0 0 0 0 0
出力例 2Copy
45
入力例 3Copy
19 885 8 1 128 83 32 256 206 639 16 4 128 689 32 8 64 885 969 1
出力例 3Copy
37
Score : points
Problem Statement
There is an integer sequence of length .
Find the number of the pairs of integers and () that satisfy the following condition:
Here, denotes the bitwise exclusive OR.
Definition of XOR
The XOR of integers is defined as follows:
- Let the XOR be . In the binary representation of , the digit in the 's place (; is an integer) is if there are an odd number of integers among whose binary representation has in the 's place, and if that number is even.
For example, let us compute the XOR of and . The binary representation of is , and the binary representation of is , thus the XOR has the binary representation , that is, the XOR is .
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the number of the pairs of integers and () that satisfy the condition.
Sample Input 1Copy
4 2 5 4 6
Sample Output 1Copy
5
clearly satisfy the condition. also satisfies the condition, since . There are no other pairs that satisfy the condition, so the answer is .
Sample Input 2Copy
9 0 0 0 0 0 0 0 0 0
Sample Output 2Copy
45
Sample Input 3Copy
19 885 8 1 128 83 32 256 206 639 16 4 128 689 32 8 64 885 969 1
Sample Output 3Copy
37