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.util.List;
import java.io.InputStreamReader;
import java.io.IOException;
import java.util.Arrays;
import java.util.ArrayList;
import java.util.Comparator;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.math.BigInteger;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author AlexFetisov
 */
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 MOD = (int) 1e9 + 7;

    public void solve(int testNumber, InputReader in, PrintWriter out) {
        int n = in.nextInt();
        int[] a = Utils.readIntArray(in, n);
        int[] dp = new int[1 << 20];
        int[] next = new int[1 << 20];
        for (int i = 0; i < n; ++i) {
            dp[a[i]]++;
        }
        for (int k = 0; k < 20; ++k) {
            for (int mask = 0; mask < (1 << 20); ++mask) {
                next[mask] += dp[mask];
                if (next[mask] >= MOD) next[mask] -= MOD;
                if (!BitUtils.checkBit(mask, k)) {
                    next[mask] += dp[BitUtils.setBit(mask, k)];
                    if (next[mask] >= MOD) next[mask] -= MOD;
                }
            }
            int[] temp = dp;
            dp = next;
            next = temp;
            Arrays.fill(next, 0);
        }
        int res = IntegerUtils.pow(2, n, MOD) - 1;
        if (res < 0) res += MOD;
        for (int mask = 1; mask < (1 << 20); ++mask) {
            int sign = 1;
            if ((Integer.bitCount(mask) & 1) == 1) {
                sign = -1;
            }
            res += sign * ((IntegerUtils.pow(2, dp[mask], MOD) - 1 + MOD) % MOD);
            while (res < 0) res += MOD;
            while (res >= MOD) res -= MOD;
        }
        out.println(res);
    }
}

class InputReader {
    private BufferedReader reader;
    private StringTokenizer stt;

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

    public String nextLine() {
        try {
            return reader.readLine().trim();
        } catch (IOException e) {
            return null;
        }
    }

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

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

}

class Utils {
    public static int[] readIntArray(InputReader in, int n) {
        int[] a = new int[n];
        for (int i = 0; i < n; ++i) {
            a[i] = in.nextInt();
        }
        return a;
    }

}

class BitUtils {
    public static boolean checkBit(int mask, int bit) {
        return (mask & (1 << bit)) > 0;
    }

    public static int setBit(int mask, int bit) {
        return (mask | (1 << bit));
    }

}

class IntegerUtils {

    public static int pow(int x, int p, int MOD) {
        int result = 1;
        for (int i = p; i > 0; i >>= 1) {
            if ((i & 1) != 0) {
                result = (int) ((result * 1L * x) % MOD);
            }
            x = (int) ((x * 1L * x) % MOD);
        }
        return result;
    }

}

