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

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

Input

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

Output

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

Examples

Input

3
2 3 3


Output

0


Input

4
0 1 2 3


Output

10


Input

6
5 2 0 5 2 1


Output

53

Solution (in JAVA):

Solution:
// practice with rainboy
import java.io.*;
import java.util.*;

public class CF449D extends PrintWriter {
	CF449D() { super(System.out, true); }
	Scanner sc = new Scanner(System.in);
	public static void main(String[] $) {
		CF449D o = new CF449D(); o.main(); o.flush();
	}

	static final int MD = 1000000007;
	int count1(int a) {
		return a == 0 ? 0 : count1(a & a - 1) + 1;
	}
	long power(int a, int k) {
		if (k == 0)
			return 1;
		long p = power(a, k / 2);
		p = p * p % MD;
		if (k % 2 == 1)
			p = p * a % MD;
		return p;
	}
	void main() {
		int n = sc.nextInt();
		int[] dp = new int[1 << 20];
		for (int i = 0; i < n; i++) {
			int a = sc.nextInt();
			dp[a]++;
		}
		for (int h = 0; h < 20; h++)
			for (int a = 0; a < 1 << 20; a++)
				if ((a & 1 << h) != 0)
					dp[a ^ 1 << h] += dp[a];
		int ans = 0;
		for (int a = 0; a < 1 << 20; a++) {
			int cnt = (int) power(2, dp[a]) - 1;
			ans = (count1(a) % 2 == 0 ? ans + cnt : ans - cnt) % MD;
		}
		if (ans < 0)
			ans += MD;
		println(ans);
	}
}