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.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.*;
import java.util.concurrent.ArrayBlockingQueue;

/**
 * Created by hama_du on 2014/07/19.
 */
public class ProblemD {

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

        int n = in.nextInt();
        int[] a = new int[n];
        int[] cnt = new int[1<<20];
        for (int i = 0 ; i < n ; i++) {
            a[i] = in.nextInt();
            cnt[a[i]]++;
        }

        long[] p2 = new long[1000010];
        p2[0] = 1;
        for (int i = 1 ; i < p2.length ; i++) {
            p2[i] = (p2[i-1] * 2) % MOD;
        }

        for (int i = 0 ; i < 20 ; i++) {
            for (int x = 0 ; x < (1<<20) ; x++) {
                if ((x & (1<<i)) == 0) {
                    cnt[x] += cnt[x | (1<<i)];
                }
            }
        }


        long total = (p2[n] + MOD - 1) % MOD;
        long answer = 0;
        for (int x = 1 ; x < (1<<20) ; x++) {
            long ptn = (p2[cnt[x]] + MOD - 1) % MOD;
            if ((Integer.bitCount(x) & 1) == 1) {
                answer += ptn;
            } else {
                answer += (MOD - ptn);
            }
        }
        answer %= MOD;

        answer = (total + 2 * MOD - answer) % MOD;
        answer %= MOD;

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

    static long MOD = 1000000007;

    static void debug(Object... obj) {
        System.err.println(Arrays.deepToString(obj));
    }

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

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

        public int next() {
            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() {
            int c = next();
            while (isSpaceChar(c))
                c = next();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = next();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = next();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null)
                return filter.isSpaceChar(c);
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);
        }
    }
}
