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

public class Main {
    private static PrintWriter out;
    private static FastReader in;

    private static final long MOD = 1000*1000*1000+7;
    private static final int MAX = 1000005,
                             MAX_POW = 1 << 20;

    private static class FastReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public FastReader(InputStream inputStream) {
            reader = new BufferedReader(
                    new InputStreamReader(inputStream), 1 << 16);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                }
                catch (IOException ex) {
                    throw new RuntimeException(ex);
                }
            }
            return tokenizer.nextToken();
        }

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

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

    }

    public static void main(String[] args) throws FileNotFoundException {
        in = new FastReader(System.in);
        out = new PrintWriter(System.out);

        int n = in.nextInt();
        int[] A = new int[n];
        int[][] F = new int[21][MAX_POW];
        for (int i = 0; i < n; ++i) {
            A[i] = in.nextInt();
            F[0][A[i]]++;
        }
        for (int i = 1; i <= 20; i++) {
            int pow = 1 << (i - 1);
            for (int j = 0; j < MAX_POW; j++) {
                F[i][j] = F[i - 1][j];
                if ((pow & j) == 0)
                    F[i][j] += F[i - 1][j + pow];
                F[i][j] %= MOD;
            }
        }

        long ans = 0;
        long[] binpow = new long[MAX];
        binpow[0] = 1;
        for (int i = 1; i < MAX; i++) {
            binpow[i] = binpow[i - 1] << 1 % MOD;
        }
        for (int i = 0; i < MAX_POW; ++i) {
            int sum = 0, number = 0;
            for (int j = 0; j < 20; ++j) {
                if ((i & (1 << j)) != 0)
                    ++number;
            }
            sum = F[20][i];
            if (number % 2 == 1) {
                ans += -binpow[sum] + MOD;
            }
            else
            {
                ans += binpow[sum];
            }
            ans %= MOD;
        }

        out.println(ans);
        out.flush();
    }

}