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


public class D {	
	BufferedReader reader;
    StringTokenizer tokenizer;
    PrintWriter out;

    int MAX_BITS = 20;
    int MAX = (1 << MAX_BITS);
    int N;
    long[] cnt;

	public void solve() throws IOException {				
		N = nextInt();
        cnt = new long[MAX];
		for (int i = 0; i < N; i++) {
            cnt[nextInt()]++;
        }

        for (int bit = MAX_BITS-1; bit >= 0; bit--) {
            for (int mask = MAX-1; mask >= 0; mask--) {
                if ( (mask & (1 << bit)) != 0) {
                    cnt[mask ^ (1 << bit)] = mod_add(cnt[mask ^ (1 << bit)], cnt[mask]);
                }
            }
        }

        long ans = 0;
        for (int mask = 0; mask < MAX; mask++) {
            if (cnt[mask] == 0) continue;
//            out.println(mask + ": " + cnt[mask]);
            if (Integer.bitCount(mask) % 2 == 0) {
                ans = mod_add(ans, mod_min(mod_power(2, cnt[mask]), 1));
            } else {
                ans = mod_min(ans, mod_min(mod_power(2, cnt[mask]), 1));
            }
        }
        out.println(ans);
	}

    long MOD = (int) 1e9 + 7;
    public long mod_add(long n1, long n2){
        return (n1 + n2) % MOD;
    }
    public long mod_min(long n1, long n2){
        return (n1 + MOD - n2) % MOD;
    }
    public long mod_time(long n1, long n2){
        return (n1 * n2) % MOD;
    }
    public long mod_power(long a, long k) {
        if (k == 0) return 1;
        if (k % 2 == 0) return mod_power(a * a % MOD, k / 2);
        return a * mod_power(a, k - 1) % MOD;
    }
	
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		new D().run();
	}
	
	public void run() {
        try {
            reader = new BufferedReader(new InputStreamReader(System.in));
            tokenizer = null;
            out = new PrintWriter(System.out);
            solve();
            reader.close();
            out.close();
        } catch (Exception e) {
            e.printStackTrace();
            System.exit(1);
        }
    }

    int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }

    long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }

    double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }

    String nextToken() throws IOException {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            tokenizer = new StringTokenizer(reader.readLine());
        }
        return tokenizer.nextToken();
    }

}
