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:
import static java.util.Arrays.*;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Random;
import java.util.StringTokenizer;

public class Main {

	final long MOD = 1000000007;

	long[] two;

	void solve() {
		final int K = 20;
		int n = sc.nextInt();
		int[] a = new int[1 << K];
		for (int i = 0; i < n; i++) {
			++a[sc.nextInt()];
		}
		two = new long[1 << K];
		two[0] = 1;
		for (int i = 1; i < two.length; i++) {
			two[i] = (two[i - 1] << 1);
			if (two[i] >= MOD)
				two[i] -= MOD;
		}
		long res = two[n];

		for (int i = 0; i < K; i++) {
			for (int s = 0; s < 1 << K; s++)
				if ((s >> i & 1) == 0)
					a[s] += a[s | (1 << i)];
		}

		for (int set = 1; set < (1 << K); set++) {
			int on = Integer.bitCount(set);
			int ge = a[set];
			long here = two[ge];
			if (on % 2 == 1) {
				res -= here;
			} else {
				res += here;
			}
		}
		res = (res % MOD + MOD) % MOD;
		System.out.println(res);
	}

	void shuffle(int[] a) {
		int n = a.length;
		Random random = new Random(System.currentTimeMillis());
		for (int i = 0; i < n; i++) {
			int j = i + random.nextInt(n - i);
			int t = a[i];
			a[i] = a[j];
			a[j] = t;
		}
	}

	void print(int[] a) {
		out.print(a[0]);
		for (int i = 1; i < a.length; i++)
			out.print(" " + a[i]);
		out.println();
	}

	static void tr(Object... os) {
		if (LOCAL)
			System.err.println(deepToString(os));
	}

	public static void main(String[] args) throws Exception {
		new Main().run();
	}

	static boolean LOCAL = System.getProperty("ONLINE_JUDGE") == null;
	static String __input = "";

	MyScanner sc = null;
	PrintWriter out = null;

	public void run() throws Exception {
		sc = new MyScanner(System.in);
		out = new PrintWriter(System.out);
		for (; sc.hasNext();) {
			solve();
			out.flush();
		}
		out.close();
	}

	class MyScanner {
		String line;
		BufferedReader reader;
		StringTokenizer tokenizer;

		public MyScanner(InputStream stream) {
			reader = new BufferedReader(new InputStreamReader(stream));
			tokenizer = null;
		}

		public void eat() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					line = reader.readLine();
					if (line == null) {
						tokenizer = null;
						return;
					}
					tokenizer = new StringTokenizer(line);
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
		}

		public String next() {
			eat();
			return tokenizer.nextToken();
		}

		public String nextLine() {
			try {
				return reader.readLine();
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}

		public boolean hasNext() {
			eat();
			return (tokenizer != null && tokenizer.hasMoreElements());
		}

		public int nextInt() {
			return Integer.parseInt(next());
		}

		public long nextLong() {
			return Long.parseLong(next());
		}

		public double nextDouble() {
			return Double.parseDouble(next());
		}

		public int[] nextIntArray(int n) {
			int[] a = new int[n];
			for (int i = 0; i < n; i++)
				a[i] = nextInt();
			return a;
		}
	}
}