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

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author George Marcus
 */
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 {
    private static final int K = 20;
    private static final int MOD = 1000000007;

    public void solve(int testNumber, InputReader in, PrintWriter out) {
        int N = in.nextInt();
        int[][] dp = new int[2][1 << K];
        for (int i = 0; i < N; i++) {
            dp[0][in.nextInt()]++;
        }

        int line = 1;
        for (int k = 1; k <= K; k++) {
            for (int x = 0; x < (1 << K); x++) {
                dp[line][x] = dp[1 - line][x];
                if ((x & (1 << (k - 1))) == 0) {
                    dp[line][x] += dp[1 - line][x | (1 << (k - 1))];
                    if (dp[line][x] >= MOD) {
                        dp[line][x] -= MOD;
                    }
                }
            }
            line = 1 - line;
        }
        line = 1 - line;

        int[] p2 = new int[N + 1];
        p2[0] = 1;
        for (int i = 1; i <= N; i++) {
            p2[i] = p2[i - 1] + p2[i - 1];
            if (p2[i] >= MOD) {
                p2[i] -= MOD;
            }
        }

        int[] size = new int[1 << K];
        int ans = 0;
        for (int x = 0; x < (1 << K); x++) {
            if (x > 0) {
                size[x] = size[x & (x - 1)] + 1;
            }

            int num = dp[line][x];
            int crt = p2[num] - 1;
            if ((size[x] & 1) > 0) {
                ans -= crt;
                if (ans < 0) {
                    ans += MOD;
                }
            }
            else {
                ans += crt;
                if (ans >= MOD) {
                    ans -= MOD;
                }
            }
        }

        out.println(ans);
    }
}

class InputReader {
    private InputStream stream;
    private byte[] buf = new byte[1024];
    private int curChar;
    private int numChars;

    public InputReader(InputStream stream) {
        this.stream = stream;
    }

    public int read() {
        if (numChars == -1)
            throw new InputMismatchException();
        if (curChar >= numChars) {
            curChar = 0;
            try {
                numChars = stream.read(buf);
            } catch (IOException e) {
                throw new InputMismatchException();
            }
            if (numChars <= 0)
                return -1;
        }
        return buf[curChar++];
    }

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

    public String nextString() {
        int c = read();
        while (isSpaceChar(c))
            c = read();
        StringBuffer res = new StringBuffer();
        do {
            res.appendCodePoint(c);
            c = read();
        } while (!isSpaceChar(c));

        return res.toString();
    }

    private boolean isSpaceChar(int c) {
        return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
    }

}

