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

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

class TaskD {
    final int MAX_VALUE = 1 << 20;
    final int MD = 1000000000 + 7;
    public void solve(int testNumber, InputReader in, PrintWriter out) {
        int n = in.nextInt();
        int[] a = new int[MAX_VALUE];
        int[] c = new int[MAX_VALUE];
        int[] deg = new int[MAX_VALUE];
        long[] f = new long[MAX_VALUE];
        deg[0] = 1;
        for (int i = 1; i < MAX_VALUE; i++) {
            deg[i] = deg[i - 1] * 2;
            if (deg[i] >= MD) deg[i] -= MD;
        }
        for (int i = 0; i < n; i++) {
            int x = in.nextInt();
           // int x = i;
            a[x]++;
            f[x]++;
            c[x]++;
        }
        long[] ff = new long[MAX_VALUE];
        int ans = deg[n] - 1;
        if (ans < 0) ans += MD;
        long[] fact = new long[23];
        fact[0] = 1;
        for (int i = 1; i <= 21; i++) {
            fact[i] = fact[i - 1] * ((long) i);
        }

        for (int j = 0; j < 20; j++) {
        for (int mask = MAX_VALUE - 1; mask > 0; mask--) {
                if (f[mask] > 0) {
                    for (int i = 0; i < 20; i++) {
                        if (((1 << i) & mask) > 0) ff[mask ^ (1 << i)] += f[mask];
                    }
                }
            }
            for (int mask = MAX_VALUE - 1; mask > 0; mask--) {
                c[mask] += ff[mask] / fact[j + 1];
                f[mask] = ff[mask];
                ff[mask] = 0;
            }
        }
        for (int mask = 1; mask < MAX_VALUE; mask++) {
            if ((Integer.bitCount(mask) & 1) == 1) ans -= deg[c[mask]] - 1;
            else ans += deg[c[mask]] - 1;
            if (ans >= MD) ans -= MD;
            if (ans < 0) ans += MD;
        }
        out.println(ans);
    }
}

class InputReader {
    private BufferedReader reader;
    private StringTokenizer tokenizer;

    public InputReader(InputStream inputStream) {
        reader = new BufferedReader(new InputStreamReader(inputStream));
    }

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

    public String next() {
        while (tokenizer == null || !tokenizer.hasMoreTokens())
            tokenizer = new StringTokenizer(nextLine());
        return tokenizer.nextToken();
    }

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

