3132.Jzzhu and Numbers

Time Limit: 1s Memory Limit: 256MB

Jzzhu have n non-negative integers a1,a2,...,an. We will call a sequence of indexes i1,i2,...,ik (1 \le i1 \lt i2 \lt ... \lt ik \le n) a group of size k.

Jzzhu wonders, how many groups exists such that ai1 & ai2 & ... & aik=0 (1 \le k \le n)? Help him and print this number modulo 1000000007 (109+7). Operation x & y denotes bitwise AND operation of two numbers.

Input Format(From the terminal/stdin)

The first line contains a single integer n (1 \le n \le 106). The second line contains n integers a1,a2,...,an (0 \le ai \le 106).

Output Format(To the terminal/stdout)

Output a single integer representing the number of required groups modulo 1000000007 (109+7).

Sample Input 1

Copy
3
2 3 3
 \n
 · · \n

Sample Output 1

Copy
0
 \n

Sample Input 2

Copy
4
0 1 2 3
 \n
 · · · \n

Sample Output 2

Copy
10
  \n

Sample Input 3

Copy
6
5 2 0 5 2 1
 \n
 · · · · · \n

Sample Output 3

Copy
53
  \n

Submit

请先 登录

© 2025 FAQs