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 java.io.IOException;
import java.io.InputStreamReader;
import java.io.FileReader;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Writer;
import java.util.StringTokenizer;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author Agostinho Junior (junior94)
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		OutputWriter out = new OutputWriter(outputStream);
		TaskD solver = new TaskD();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskD {
	OutputWriter out;
	InputReader in;
	public void solve(int testNumber, InputReader in, OutputWriter out) {
		this.in = in; this.out = out;
		int[] f = getF();
		long ans = 0;
		XMath math = new XMath((long)1e9 + 7);
		for (int x = 0; x <= 1 << 20; x++) {
			long mul = (Integer.bitCount(x) & 1) == 0 ? 1 : - 1;
			ans = math.mod(ans + mul * (math.modPow(2, f[x]) - 1));
			/*if (x <= 10) {
				System.out.printf("x: %d, g: %d, f: %d, ans: %d\n", x, Integer.bitCount(x), f[x], ans);
			}*/
		}
		out.println(ans);
	}
	public int[] getF() {
		int N = in.readInt();
		final int MAX_BIT = 20;
		int[][] f = new int[2][1 << MAX_BIT + 1];
		for (int i = 0; i < N; i++) {
			f[0][in.readInt()]++;
		}
		for (int k = 1; k <= MAX_BIT + 1; k++) {
			int ki = k - 1;
			for (int x = 0; x <= 1 << MAX_BIT; x++) {
				f[k & 1][x] = f[(k - 1) & 1][x];
				if ((x & (1 << ki)) == 0) {
					f[k & 1][x] += f[(k - 1) & 1][x | (1 << ki)];
				}
			}
		}
		return f[MAX_BIT & 1];
	}
}

class OutputWriter {
	private PrintWriter output;
	public OutputWriter() {
		this(System.out);
	}
	public OutputWriter(OutputStream out) {
		output = new PrintWriter(out);
	}
	public OutputWriter(Writer writer) {
		output = new PrintWriter(writer);
	}

	public void println(Object o) {
		output.println(o);
	}

	public void close() {
		output.close();
	}
}

class InputReader {
	private BufferedReader input;
	private StringTokenizer line = new StringTokenizer("");
	public InputReader() {
		this(System.in);
	}
	public InputReader(InputStream in) {
		input = new BufferedReader(new InputStreamReader(in));
	}
	public InputReader(String s) {
		try {
			input = new BufferedReader(new FileReader(s));
		} catch(IOException io) { io.printStackTrace(); System.exit(0);}
	}
	public void fill() {
		try {
			if(!line.hasMoreTokens()) line = new StringTokenizer(input.readLine());
		} catch(IOException io) { io.printStackTrace(); System.exit(0);}
	}

	public int readInt() {
		fill();
		return Integer.parseInt(line.nextToken());
	}
}

class XMath {

	private long MOD;

	public XMath(long MOD) {
		this.MOD = MOD;
	}

	public long mod(long x) {
		return mod(x, MOD);
	}

	public long modPow(long x, long n) {
		return modPow(x, n, MOD);
	}

	public static long mod(long n, long MOD) {
		if (n < MOD) {
			if (n < 0) {
				return mod(n + MOD * (Long.MAX_VALUE / MOD), MOD);
			}
			return n;
		}
		return n % MOD;
	}

	public static long modPow(long x, long n, long MOD) {
		long res = 1;
		long mul = x;
		while (n > 0) {
			if ((n & 1) > 0) {
				res = mod(res * mul, MOD);
			}
			mul = mod(mul * mul, MOD);
			n >>= 1;
		}
		return res;
	}

}