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 static java.lang.Math.pow;
import java.math.BigInteger.*;
import static java.math.BigInteger.*;
import java.util.*;
import static java.util.Arrays.fill;
import static java.util.Arrays.fill;

//<editor-fold defaultstate="collapsed" desc="Imports">
//</editor-fold>
// https://netbeans.org/kb/73/java/editor-codereference_ru.html#display
//<editor-fold defaultstate="collapsed" desc="Main">
public class Main {
    private void run() {
        Locale.setDefault(Locale.US);
        boolean oj = true;
        try {
            oj = System.getProperty("MYLOCAL") == null;
        } catch (Exception e) {
        }
        
        if (oj) {
            sc = new FastScanner(new InputStreamReader(System.in));
            out = new PrintWriter(new OutputStreamWriter(System.out));
        } else {
            try {
                sc = new FastScanner(new FileReader("input.txt"));
                out = new PrintWriter(new FileWriter("output.txt"));
            } catch (IOException e) {
                MLE();
            }
        }
        Solver s = new Solver();
        s.sc = sc;
        s.out = out;
        s.solve();
        err.println("Time: " + (System.currentTimeMillis() - timeBegin) / 1e3);
        out.flush();
    }
    
    private void show(int[] arr) {
        for (int v : arr) {
            err.print(" " + v);
        }
        err.println();
    }
    
    public static void MLE() {
//        int[][] arr = new int[1024 * 1024][];
//        for (int i = 0; i < arr.length; i++) {
//            arr[i] = new int[1024 * 1024];
//        }
        System.exit(0);
    }
    
    public static void main(String[] args) {
        new Main().run();
    }
    
    long timeBegin = System.currentTimeMillis();
    FastScanner sc;
    PrintWriter out;
    PrintStream err = System.err;
}
//</editor-fold>

//<editor-fold defaultstate="collapsed" desc="FastScanner">
class FastScanner {
    
    BufferedReader br;
    StringTokenizer st;
    
    FastScanner(InputStreamReader reader) {
        br = new BufferedReader(reader);
        st = new StringTokenizer("");
    }
    
    String next() {
        while (!st.hasMoreElements()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (IOException ex) {
                Main.MLE();
            }
        }
        return st.nextToken();
    }
    
    int nextInt() {
        return Integer.parseInt(next());
    }
    
    long nextLong() {
        return Long.parseLong(next());
    }
}
//</editor-fold>


class Solver {

    FastScanner sc;
    PrintWriter out;
    PrintStream err = System.err;

    
    final int cntBits = 20, mod = (int)1e9 + 7;
    int n;
    int[] a;
    int[] f = new int[1<<cntBits];
    final long[] pow2 = new long[1<<cntBits];
    {
        pow2[0] = 1;
        for (int i = 1; i < pow2.length; i++) {
            pow2[i] = (pow2[i-1] * 2) % mod;
        }
    }
    
    void solve(){
        n = sc.nextInt();
        a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
            ++f[a[i]];
        }
//        bf();
        for (int k = 1; k <= cntBits; k++) {
            for (int msk = 0; msk < (1<<cntBits); msk++) {
                if( (msk&(1<<(k-1))) == 0 )
                    f[msk] = (f[msk] + f[msk+(1<<(k-1))]) % mod;
            }
        }
//        err.println(Arrays.toString(f[cntBits]));
        long ans = 0;
        for (int msk = 0; msk < (1<<cntBits); msk++) {
            long cur = pow2[f[msk]];
            if( Integer.bitCount(msk)%2==0 )
                ans += cur;
            else
                ans -= cur;
        }
        ans = ( ans % mod + mod ) % mod;
        out.println( ans );
    }

//    void bf() {
//        int[] ffff = new int[1<<cntBits];
//        for (int ai : a) {
//            for (int x = 0; x < ffff.length; x++) {
//                if ((ai & x) == x) {
//                    ++ffff[x];
//                }
//            }
//        }
//        err.println(Arrays.toString(ffff));
//
//        double ans = 0;
//        for (int x = 0; x < ffff.length; x++) {
//            ans += pow(-1, Integer.bitCount(x)) * pow(2, ffff[x]);
//            out.printf("%4s %d %3.0f\n",
//                    Integer.toBinaryString(x),
//                    ffff[x],
//                    pow(-1, Integer.bitCount(x)) * pow(2, ffff[x]));
//        }
//        out.println(ans);
//    }
}
