2
1 31
 2
1 0
 10
450661 128600 993228 725823 293549 33490 843121 903634 556169 448234
 1
1
 5
1 3 5 7 9
 6
524 529 5249 524 529 529
 3
1 2 3
 2
0 1
 55
0 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 2 3 4 5 6 7 8 9 3 4 5 6 7 8 9 4 5 6 7 8 9 5 6 7 8 9 6 7 8 9 7 8 9 8 9 9
 16
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
 3
128 1024 2048
 10
3 3 3 5 5 3 3 3 3 5
 1
0
 2
1 2
 2
0 0
 2
1 1

0
 2
 632
 0
 0
 24
 2
 2
 621247139
 64594
 4
 0
 1
 1
 3
 0

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;
	}

}

