import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.BitSet;
import java.util.Calendar;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.PriorityQueue;
import java.util.SortedSet;
import java.util.Stack;
import java.util.StringTokenizer;
import java.util.TreeMap;
import java.util.TreeSet;

/**
 * #
 * @author pttrung
 */
public class D_Round_257_Div1 {

    public static long MOD = 1000000007;

    public static void main(String[] args) throws FileNotFoundException {
        // PrintWriter out = new PrintWriter(new FileOutputStream(new File(
        // "output.txt")));
        PrintWriter out = new PrintWriter(System.out);
        Scanner in = new Scanner();
        int n = in.nextInt();
        int[]data = new int[n];
        long[]count = new long[1<<20];
        for(int i = 0; i < n; i++){
        	data[i] = in.nextInt();
        	count[data[i]]++;
        }
      //  System.out.println("HE HE");

        for(int i = 0; i < 20; i++){
        	for(int j = (1 << 20) - 1; j >= 0; j-- ){
        		if(((1<<i) & j) == 0){
        			count[j] += count[j | (1<<i)];
        		}
        	}
        }
        long result = 0;
        for(int i = 0; i < 1<<20; i++){
        	long sign = Integer.bitCount(i) % 2 == 0 ? 1 : -1;
        	result += (sign * pow(2, count[i]) + MOD) % MOD;
        	result %= MOD;
        }
        out.println(result);
        out.close();
    }

    public static int[] KMP(String val) {
        int i = 0;
        int j = -1;
        int[] result = new int[val.length() + 1];
        result[0] = -1;
        while (i < val.length()) {
            while (j >= 0 && val.charAt(j) != val.charAt(i)) {
                j = result[j];
            }
            j++;
            i++;
            result[i] = j;
        }
        return result;

    }

    public static boolean nextPer(int[] data) {
        int i = data.length - 1;
        while (i > 0 && data[i] < data[i - 1]) {
            i--;
        }
        if (i == 0) {
            return false;
        }
        int j = data.length - 1;
        while (data[j] < data[i - 1]) {
            j--;
        }
        int temp = data[i - 1];
        data[i - 1] = data[j];
        data[j] = temp;
        Arrays.sort(data, i, data.length);
        return true;
    }

    public static int digit(long n) {
        int result = 0;
        while (n > 0) {
            n /= 10;
            result++;
        }
        return result;
    }

    public static double dist(long a, long b, long x, long y) {
        double val = (b - a) * (b - a) + (x - y) * (x - y);
        val = Math.sqrt(val);
        double other = x * x + a * a;
        other = Math.sqrt(other);
        return val + other;

    }

    public static class Point implements Comparable<Point> {

        int x, y;

        public Point(int start, int end) {
            this.x = start;
            this.y = end;
        }

        @Override
        public int hashCode() {
            int hash = 5;
            hash = 47 * hash + this.x;
            hash = 47 * hash + this.y;
            return hash;
        }

        @Override
        public boolean equals(Object obj) {
            if (obj == null) {
                return false;
            }
            if (getClass() != obj.getClass()) {
                return false;
            }
            final Point other = (Point) obj;
            if (this.x != other.x) {
                return false;
            }
            if (this.y != other.y) {
                return false;
            }
            return true;
        }

        @Override
        public int compareTo(Point o) {
            return x - o.x;
        }
    }

    public static class FT {

        long[] data;

        FT(int n) {
            data = new long[n];
        }

        public void update(int index, long value) {
            while (index < data.length) {
                data[index] += value;
                index += (index & (-index));
            }
        }

        public long get(int index) {
            long result = 0;
            while (index > 0) {
                result += data[index];
                index -= (index & (-index));
            }
            return result;

        }
    }

    public static long gcd(long a, long b) {
        if (b == 0) {
            return a;
        }
        return gcd(b, a % b);
    }

    public static long pow(long a, long b) {
        if (b == 0) {
            return 1;
        }
        if (b == 1) {
            return a;
        }
        long val = pow(a, b / 2);
        if (b % 2 == 0) {
            return val * val % MOD;
        } else {
            return val * (val * a % MOD) % MOD;

        }
    }

    static class Scanner {

        BufferedReader br;
        StringTokenizer st;

        public Scanner() throws FileNotFoundException {
            // System.setOut(new PrintStream(new BufferedOutputStream(System.out), true));
            br = new BufferedReader(new InputStreamReader(System.in));
            //  br = new BufferedReader(new InputStreamReader(new FileInputStream(new File("input.txt"))));
        }

        public String next() {

            while (st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (Exception e) {
                    throw new RuntimeException();
                }
            }
            return st.nextToken();
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

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

        public double nextDouble() {
            return Double.parseDouble(next());
        }

        public String nextLine() {
            st = null;
            try {
                return br.readLine();
            } catch (Exception e) {
                throw new RuntimeException();
            }
        }

        public boolean endLine() {
            try {
                String next = br.readLine();
                while (next != null && next.trim().isEmpty()) {
                    next = br.readLine();
                }
                if (next == null) {
                    return true;
                }
                st = new StringTokenizer(next);
                return st.hasMoreTokens();
            } catch (Exception e) {
                throw new RuntimeException();
            }
        }
    }
}


import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.BitSet;
import java.util.Calendar;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.PriorityQueue;
import java.util.SortedSet;
import java.util.Stack;
import java.util.StringTokenizer;
import java.util.TreeMap;
import java.util.TreeSet;

/**
 * #
 * @author pttrung
 */
public class D_Round_257_Div1 {

    public static long MOD = 1000000007;

    public static void main(String[] args) throws FileNotFoundException {
        // PrintWriter out = new PrintWriter(new FileOutputStream(new File(
        // "output.txt")));
        PrintWriter out = new PrintWriter(System.out);
        Scanner in = new Scanner();
        int n = in.nextInt();
        int[]data = new int[n];
        for(int i = 0; i <n; i++){
            data[i] = in.nextInt();
        }
        HashMap<Integer , Integer> map = new HashMap();
        for(int i = 0; i < n; i++){

            for(int j : map.keySet()){
                int v = j & data[i];
                if(!map.containsKey(v)){
                    map.put(v, map.get(j));
                }else{
                    map.put(v , (int)((map.get(v) + map.get(j)) % MOD));
                }
            }
            if(!map.containsKey(data[i])){
                map.put(data[i], 1);
            }else{
                map.put(data[i], (int)((map.get(data[i]) + 1) % MOD ));
            }
        }
        out.println(map.containsKey(0) ? map.get(0) : 0);
        out.close();
    }

    public static int[] KMP(String val) {
        int i = 0;
        int j = -1;
        int[] result = new int[val.length() + 1];
        result[0] = -1;
        while (i < val.length()) {
            while (j >= 0 && val.charAt(j) != val.charAt(i)) {
                j = result[j];
            }
            j++;
            i++;
            result[i] = j;
        }
        return result;

    }

    public static boolean nextPer(int[] data) {
        int i = data.length - 1;
        while (i > 0 && data[i] < data[i - 1]) {
            i--;
        }
        if (i == 0) {
            return false;
        }
        int j = data.length - 1;
        while (data[j] < data[i - 1]) {
            j--;
        }
        int temp = data[i - 1];
        data[i - 1] = data[j];
        data[j] = temp;
        Arrays.sort(data, i, data.length);
        return true;
    }

    public static int digit(long n) {
        int result = 0;
        while (n > 0) {
            n /= 10;
            result++;
        }
        return result;
    }

    public static double dist(long a, long b, long x, long y) {
        double val = (b - a) * (b - a) + (x - y) * (x - y);
        val = Math.sqrt(val);
        double other = x * x + a * a;
        other = Math.sqrt(other);
        return val + other;

    }

    public static class Point implements Comparable<Point> {

        int x, y;

        public Point(int start, int end) {
            this.x = start;
            this.y = end;
        }

        @Override
        public int hashCode() {
            int hash = 5;
            hash = 47 * hash + this.x;
            hash = 47 * hash + this.y;
            return hash;
        }

        @Override
        public boolean equals(Object obj) {
            if (obj == null) {
                return false;
            }
            if (getClass() != obj.getClass()) {
                return false;
            }
            final Point other = (Point) obj;
            if (this.x != other.x) {
                return false;
            }
            if (this.y != other.y) {
                return false;
            }
            return true;
        }

        @Override
        public int compareTo(Point o) {
            return x - o.x;
        }
    }

    public static class FT {

        long[] data;

        FT(int n) {
            data = new long[n];
        }

        public void update(int index, long value) {
            while (index < data.length) {
                data[index] += value;
                index += (index & (-index));
            }
        }

        public long get(int index) {
            long result = 0;
            while (index > 0) {
                result += data[index];
                index -= (index & (-index));
            }
            return result;

        }
    }

    public static long gcd(long a, long b) {
        if (b == 0) {
            return a;
        }
        return gcd(b, a % b);
    }

    public static long pow(long a, long b, long MOD) {
        if (b == 0) {
            return 1;
        }
        if (b == 1) {
            return a;
        }
        long val = pow(a, b / 2, MOD);
        if (b % 2 == 0) {
            return val * val % MOD;
        } else {
            return val * (val * a % MOD) % MOD;

        }
    }

    static class Scanner {

        BufferedReader br;
        StringTokenizer st;

        public Scanner() throws FileNotFoundException {
            // System.setOut(new PrintStream(new BufferedOutputStream(System.out), true));
            br = new BufferedReader(new InputStreamReader(System.in));
            //  br = new BufferedReader(new InputStreamReader(new FileInputStream(new File("input.txt"))));
        }

        public String next() {

            while (st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (Exception e) {
                    throw new RuntimeException();
                }
            }
            return st.nextToken();
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

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

        public double nextDouble() {
            return Double.parseDouble(next());
        }

        public String nextLine() {
            st = null;
            try {
                return br.readLine();
            } catch (Exception e) {
                throw new RuntimeException();
            }
        }

        public boolean endLine() {
            try {
                String next = br.readLine();
                while (next != null && next.trim().isEmpty()) {
                    next = br.readLine();
                }
                if (next == null) {
                    return true;
                }
                st = new StringTokenizer(next);
                return st.hasMoreTokens();
            } catch (Exception e) {
                throw new RuntimeException();
            }
        }
    }
}


/*Author: Satyajeet Singh, Delhi Technological University*/
    import java.io.*;
    import java.util.*;
    import java.text.*;
    import java.lang.*;
    import java.math.*;

public class Main{
/*********************************************Constants******************************************/
    static PrintWriter out=new PrintWriter(new OutputStreamWriter(System.out));
    static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    static long mod=(long)1e9+7;
    static long mod1=998244353;
    static boolean sieve[];
    static ArrayList<Integer> primes;
    static long factorial[],invFactorial[];
    static ArrayList<Pair> graph[];
    static boolean oj = System.getProperty("ONLINE_JUDGE") != null;
    static int pptr=0;
    static String st[];
/****************************************Solutions Begins***************************************/
    static int n;
    static long input[];
    static long dp[][];
    static long dfs(int mask,int bit){
        if(bit==20){
            //printMask(mask);
            return input[mask];
        }
        if(dp[mask][bit]!=-1){
            return dp[mask][bit];
        }
        long ans=0;
        if((mask&(1<<bit))!=0){
            ans+=dfs(mask,bit+1);
        }
        else{
            ans+=dfs(mask,bit+1)+dfs(mask^(1<<bit),bit+1);
        }
        dp[mask][bit]=ans;
        return dp[mask][bit];
    }
    static final int m=20;

    public static void main(String[] args) throws Exception{
        nl();
        n=pi();
        nl();
        dp=new long[(1<<m)+1][m+1];
        for(long arr[]:dp)
            Arrays.fill(arr,-1);
        input=new long[(1<<m)+1];
        for(int i=0;i<n;i++){
            input[pi()]++;
        }
        int cnt[]=new int[1<<m];
        for(int mask=1;mask<(1<<m);mask++){
            cnt[mask]=cnt[mask&(mask-1)]+1;
        }
        // debug(cnt);
        // for(int i=0;i<=m;i++){
        //     for(int mask=0;mask<(1<<m);mask++){
        //         if((mask&(1<<i))!=0){
        //             dp[mask^(1<<i)]+=dp[mask];
        //         }
        //     }
        // }
        // debug(dp);
        long ans=0;
        for(int i=0;i<(1<<m);i++){
            int b=cnt[i];
            if(b%2==0){
                ans+=modulo(2,dfs(i,0),mod)-1;
                if(ans>=mod)ans-=mod;
            }
            else{
                ans-=modulo(2,dfs(i,0),mod)-1;
                if(ans<0)ans+=mod;
            }
        }
        out.println(ans);
/****************************************Solutions Ends**************************************************/
        out.flush();
        out.close();
    }
/****************************************Template Begins************************************************/
    static void nl() throws Exception{
        pptr=0;
        st=br.readLine().split(" ");
    }
    static void nls() throws Exception{
        pptr=0;
        st=br.readLine().split("");
    }
    static int pi(){
        return Integer.parseInt(st[pptr++]);
    }
    static long pl(){
        return Long.parseLong(st[pptr++]);
    }
    static double pd(){
        return Double.parseDouble(st[pptr++]);
    }
/***************************************Precision Printing**********************************************/
    static void printPrecision(double d){
        DecimalFormat ft = new DecimalFormat("0.000000000000000000000");
        out.print(ft.format(d));
    }
/**************************************Bit Manipulation**************************************************/
    static void printMask(long mask){
        System.out.println(Long.toBinaryString(mask));
    }
    static long countBit(long mask){
        long ans=0;
        while(mask!=0){
            if(mask%2==1){
                ans++;
            }
            mask/=2;
        }
        return ans;
    }
/******************************************Graph*********************************************************/
    static void Makegraph(int n){
        graph=new ArrayList[n];
        for(int i=0;i<n;i++){
            graph[i]=new ArrayList<>();
        }
    }
    static void addEdge(int a,int b){
        graph[a].add(new Pair(b,1));
    }
    static void addEdge(int a,int b,int c){
        graph[a].add(new Pair(b,c));
    }
/*********************************************PAIR********************************************************/
    static class Pair implements Comparable<Pair> {
        int u;
        int v;
        int index=-1;
        public Pair(int u, int v) {
            this.u = u;
            this.v = v;
        }
        public int hashCode() {
            int hu = (int) (u ^ (u >>> 32));
            int hv = (int) (v ^ (v >>> 32));
            return 31 * hu + hv;
        }
        public boolean equals(Object o) {
            Pair other = (Pair) o;
            return u == other.u && v == other.v;
        }
        public int compareTo(Pair other) {
            if(index!=other.index)
                return Long.compare(index, other.index);
            return Long.compare(v, other.v)!=0?Long.compare(v, other.v):Long.compare(u, other.u);
        }
        public String toString() {
            return "[u=" + u + ", v=" + v + "]";
        }
    }
/******************************************Long Pair*******************************************************/
    static class Pairl implements Comparable<Pairl> {
            long u;
            long v;
            int index=-1;
            public Pairl(long u, long v) {
                this.u = u;
                this.v = v;
            }
            public int hashCode() {
                int hu = (int) (u ^ (u >>> 32));
                int hv = (int) (v ^ (v >>> 32));
                return 31 * hu + hv;
            }
            public boolean equals(Object o) {
                Pairl other = (Pairl) o;
                return u == other.u && v == other.v;
            }
            public int compareTo(Pairl other) {
                if(index!=other.index)
                    return Long.compare(index, other.index);
                return Long.compare(v, other.v)!=0?Long.compare(v, other.v):Long.compare(u, other.u);
            }
            public String toString() {
                return "[u=" + u + ", v=" + v + "]";
            }
        }
/*****************************************DEBUG***********************************************************/
    public static void debug(Object... o) {
        if(!oj)
        System.out.println(Arrays.deepToString(o));
    }
/************************************MODULAR EXPONENTIATION***********************************************/
    static long modulo(long a,long b,long c) {
        long x=1;
        long y=a%c;
        while(b > 0){
            if(b%2 == 1){
                x=(x*y)%c;
            }
            y = (y*y)%c; // squaring the base
            b /= 2;
        }
        return  x%c;
    }
/********************************************GCD**********************************************************/
    static long gcd(long x, long y)
    {
        if(x==0)
            return y;
        if(y==0)
            return x;
        long r=0, a, b;
        a = (x > y) ? x : y; // a is greater number
        b = (x < y) ? x : y; // b is smaller number
        r = b;
        while(a % b != 0)
        {
            r = a % b;
            a = b;
            b = r;
        }
        return r;
    }
/******************************************SIEVE**********************************************************/
    static void sieveMake(int n){
        sieve=new boolean[n];
        Arrays.fill(sieve,true);
        sieve[0]=false;
        sieve[1]=false;
        for(int i=2;i*i<n;i++){
            if(sieve[i]){
                for(int j=i*i;j<n;j+=i){
                    sieve[j]=false;
                }
            }
        }
        primes=new ArrayList<Integer>();
        for(int i=0;i<n;i++){
            if(sieve[i]){
                primes.add(i);
            }
        }
    }
/********************************************End***********************************************************/
}


/*Author: Satyajeet Singh, Delhi Technological University*/
    import java.io.*;
    import java.util.*;
    import java.text.*;
    import java.lang.*;
    import java.math.*;

public class Main{
/*********************************************Constants******************************************/
    static PrintWriter out=new PrintWriter(new OutputStreamWriter(System.out));
    static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    static long mod=(long)1e9+7;
    static long mod1=998244353;
    static boolean sieve[];
    static ArrayList<Integer> primes;
    static long factorial[],invFactorial[];
    static ArrayList<Pair> graph[];
    static boolean oj = System.getProperty("ONLINE_JUDGE") != null;
    static int pptr=0;
    static String st[];
/****************************************Solutions Begins***************************************/
    static int n,input[];
    static long dp[];
    static long dfs(int mask){
        if(dp[mask]!=-1){
            return dp[mask];
        }
        long ans=input[mask];
        for(int i=0;i<20;i++){
            if((mask&(1<<i))!=0){
                ans=(ans+dfs(mask^(1<<i)));
                if(ans>=mod)ans-=mod;
            }
        }
        dp[mask]=ans;
        return dp[mask];
    }
    static final int m=20;

    public static void main(String[] args) throws Exception{
        nl();
        n=pi();
        nl();
        dp=new long[1<<m];
        int mx=0;
        for(int i=0;i<n;i++){
            int a=pi();
            mx=Math.max(a,mx);
            dp[a]++;
        }
        int cnt[]=new int[1<<m];
        for(int mask=1;mask<(1<<m);mask++){
            cnt[mask]=cnt[mask&(mask-1)]+1;
        }
        // debug(cnt);
        for(int i=0;i<=m;i++){
            for(int mask=0;mask<(1<<m);mask++){
                if((mask&(1<<i))!=0){
                    dp[mask^(1<<i)]+=dp[mask];
                }
            }
        }
        // debug(dp);
        long ans=0;
        for(int i=0;i<(1<<m);i++){
            int b=cnt[i];
            if(b%2==0){
                ans+=modulo(2,dp[i],mod)-1;
                if(ans>=mod)ans-=mod;
            }
            else{
                ans-=modulo(2,dp[i],mod)-1;
                if(ans<0)ans+=mod;
            }
        }
        out.println(ans);
/****************************************Solutions Ends**************************************************/
        out.flush();
        out.close();
    }
/****************************************Template Begins************************************************/
    static void nl() throws Exception{
        pptr=0;
        st=br.readLine().split(" ");
    }
    static void nls() throws Exception{
        pptr=0;
        st=br.readLine().split("");
    }
    static int pi(){
        return Integer.parseInt(st[pptr++]);
    }
    static long pl(){
        return Long.parseLong(st[pptr++]);
    }
    static double pd(){
        return Double.parseDouble(st[pptr++]);
    }
/***************************************Precision Printing**********************************************/
    static void printPrecision(double d){
        DecimalFormat ft = new DecimalFormat("0.000000000000000000000");
        out.print(ft.format(d));
    }
/**************************************Bit Manipulation**************************************************/
    static void printMask(long mask){
        System.out.println(Long.toBinaryString(mask));
    }
    static long countBit(long mask){
        long ans=0;
        while(mask!=0){
            if(mask%2==1){
                ans++;
            }
            mask/=2;
        }
        return ans;
    }
/******************************************Graph*********************************************************/
    static void Makegraph(int n){
        graph=new ArrayList[n];
        for(int i=0;i<n;i++){
            graph[i]=new ArrayList<>();
        }
    }
    static void addEdge(int a,int b){
        graph[a].add(new Pair(b,1));
    }
    static void addEdge(int a,int b,int c){
        graph[a].add(new Pair(b,c));
    }
/*********************************************PAIR********************************************************/
    static class Pair implements Comparable<Pair> {
        int u;
        int v;
        int index=-1;
        public Pair(int u, int v) {
            this.u = u;
            this.v = v;
        }
        public int hashCode() {
            int hu = (int) (u ^ (u >>> 32));
            int hv = (int) (v ^ (v >>> 32));
            return 31 * hu + hv;
        }
        public boolean equals(Object o) {
            Pair other = (Pair) o;
            return u == other.u && v == other.v;
        }
        public int compareTo(Pair other) {
            if(index!=other.index)
                return Long.compare(index, other.index);
            return Long.compare(v, other.v)!=0?Long.compare(v, other.v):Long.compare(u, other.u);
        }
        public String toString() {
            return "[u=" + u + ", v=" + v + "]";
        }
    }
/******************************************Long Pair*******************************************************/
    static class Pairl implements Comparable<Pairl> {
            long u;
            long v;
            int index=-1;
            public Pairl(long u, long v) {
                this.u = u;
                this.v = v;
            }
            public int hashCode() {
                int hu = (int) (u ^ (u >>> 32));
                int hv = (int) (v ^ (v >>> 32));
                return 31 * hu + hv;
            }
            public boolean equals(Object o) {
                Pairl other = (Pairl) o;
                return u == other.u && v == other.v;
            }
            public int compareTo(Pairl other) {
                if(index!=other.index)
                    return Long.compare(index, other.index);
                return Long.compare(v, other.v)!=0?Long.compare(v, other.v):Long.compare(u, other.u);
            }
            public String toString() {
                return "[u=" + u + ", v=" + v + "]";
            }
        }
/*****************************************DEBUG***********************************************************/
    public static void debug(Object... o) {
        if(!oj)
        System.out.println(Arrays.deepToString(o));
    }
/************************************MODULAR EXPONENTIATION***********************************************/
    static long modulo(long a,long b,long c) {
        long x=1;
        long y=a%c;
        while(b > 0){
            if(b%2 == 1){
                x=(x*y)%c;
            }
            y = (y*y)%c; // squaring the base
            b /= 2;
        }
        return  x%c;
    }
/********************************************GCD**********************************************************/
    static long gcd(long x, long y)
    {
        if(x==0)
            return y;
        if(y==0)
            return x;
        long r=0, a, b;
        a = (x > y) ? x : y; // a is greater number
        b = (x < y) ? x : y; // b is smaller number
        r = b;
        while(a % b != 0)
        {
            r = a % b;
            a = b;
            b = r;
        }
        return r;
    }
/******************************************SIEVE**********************************************************/
    static void sieveMake(int n){
        sieve=new boolean[n];
        Arrays.fill(sieve,true);
        sieve[0]=false;
        sieve[1]=false;
        for(int i=2;i*i<n;i++){
            if(sieve[i]){
                for(int j=i*i;j<n;j+=i){
                    sieve[j]=false;
                }
            }
        }
        primes=new ArrayList<Integer>();
        for(int i=0;i<n;i++){
            if(sieve[i]){
                primes.add(i);
            }
        }
    }
/********************************************End***********************************************************/
}


import java.io.InputStreamReader;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		FastScanner in = new FastScanner(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskD solver = new TaskD();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskD {
    public void solve(int testNumber, FastScanner in, PrintWriter out) {
		final int MOD = (int)(1e9 + 7);
		int n = in.nextInt();
		int k = 20;
		int[] d = new int[1 << k];
		int[] a = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = in.nextInt();
			++d[a[i]];
		}
		for (int i = 0; i < k; i++) {
			for (int mask = 0; mask < 1<<k; mask++) {
				if ((mask & (1 << i)) == 0) {
					d[mask] += d[mask | (1 << i)];
				}
			}
		}
		int[] p2 = new int[n + 1];
		p2[0] = 1;
		for (int i = 1; i < p2.length; i++) {
			p2[i] = 2 * p2[i - 1] % MOD;
		}
		int ans = 0;
		for (int mask = 0; mask < 1<<k; mask++) {
			if (Integer.bitCount(mask) % 2 == 0) {
				ans += p2[d[mask]];
				if (ans >= MOD) {
					ans -= MOD;
				}
			} else {
				ans -= p2[d[mask]];
				if (ans < 0) {
					ans += MOD;
				}
			}
		}
		out.println(ans);
    }

}

class FastScanner {

	private BufferedReader in;
	private StringTokenizer st;

	public FastScanner(InputStream stream) {
		in = new BufferedReader(new InputStreamReader(stream));
	}

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

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

	public long nextLong() {
		return Long.parseLong(next());
	}

	public double nextDouble() {
		return Double.parseDouble(next());
	}

}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Scanner;
import java.util.StringTokenizer;

public class D257 {
	static final long MOD = (long)(1e9+7);
	static long[] fs;
	static long[][] memo;
	public static void main(String[] args) {
		MyScanner in = new MyScanner();
		int n = in.nextInt();
		fs = new long[1 << 20];
		for(int i=0;i<n;i++) {
			fs[in.nextInt()]++;
		}
		memo = new long[20][1 << 20];
		for(long[] arr : memo)
			Arrays.fill(arr, -1);
		long ans = 0;
		for(int i=0;i<fs.length;i++) {
			int bitcount = Integer.bitCount(i);
			ans += fmpow(2,countSupersets(i, 0)) * (bitcount % 2 == 0 ? 1 : -1);
			ans %= MOD;
		}
		if(ans < 0)
			ans += MOD;
		System.out.println(ans);

	}
	static long fmpow(long a, long b) {
		if(b == 0)
			return 1;
		if(b == 1)
			return a;
		long bonus = 1;
		while(b > 1) {
			if(b % 2 != 0)
				bonus = (bonus * a) % MOD;
			b /= 2;
			a = (a*a)%MOD;
		}
		return (a*bonus)%MOD;
	}
	public static long countSupersets(int mask, int idx) {
		 if(idx == 20)
			 return fs[mask];
		 if(memo[idx][mask] != -1)
			 return memo[idx][mask];
		 long ans = countSupersets(mask, idx+1);
		 int bit = 1 << idx;
		 if((mask & bit) == 0)
			 ans += countSupersets(mask|bit,idx+1);
		 return memo[idx][mask] = ans;
	}

	private static class MyScanner {
		BufferedReader br;
		StringTokenizer st;

		public MyScanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String next() {
			while (st == null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

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

		long nextLong() {
			return Long.parseLong(next());
		}
	}
}


import java.util.Arrays;
import java.util.Scanner;

public class D257 {
	static final long MOD = (long)(1e9+7);
	static long[] fs;
	static long[][] memo;
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		fs = new long[1 << 20];
		for(int i=0;i<n;i++) {
			fs[in.nextInt()]++;
		}
		memo = new long[20][1 << 20];
		for(long[] arr : memo)
			Arrays.fill(arr, -1);
		long ans = 0;
		for(int i=0;i<fs.length;i++) {
			int bitcount = Integer.bitCount(i);
			ans += fmpow(2,countSupersets(i, 0)) * (bitcount % 2 == 0 ? 1 : -1);
			ans %= MOD;
		}
		if(ans < 0)
			ans += MOD;
		System.out.println(ans);

	}
	static long fmpow(long a, long b) {
		if(b == 0)
			return 1;
		if(b == 1)
			return a;
		long bonus = 1;
		while(b > 1) {
			if(b % 2 != 0)
				bonus = (bonus * a) % MOD;
			b /= 2;
			a = (a*a)%MOD;
		}
		return (a*bonus)%MOD;
	}
	public static long countSupersets(int mask, int idx) {
		 if(idx == 20)
			 return fs[mask];
		 if(memo[idx][mask] != -1)
			 return memo[idx][mask];
		 long ans = countSupersets(mask, idx+1);
		 int bit = 1 << idx;
		 if((mask & bit) == 0)
			 ans += countSupersets(mask|bit,idx+1);
		 return memo[idx][mask] = ans;
	}
}


import java.math.BigInteger;
import java.util.*;
import java.io.*;
import java.text.*;
public class Main{
    //SOLUTION BEGIN
    //Into the Hardware Mode
    void pre() throws Exception{}
    void solve(int TC) throws Exception{
        int n = ni(), B = 3;
        long[] a = new long[1<<B];
        long MOD = (long)1e9+7;
        for(int i = 0; i< n; i++)a[ni()]++;
        for(int b = 0; b< B; b++)
            for(int i = 0; i< 1<<B; i++)
                if(((i>>b)&1)==1)
                    a[i^(1<<b)] += a[i];
        long ans = 0;
        for(int i = 0; i< a.length; i++)ans = (ans+MOD+(bit(i)%2 == 0?1:-1)*pow(2, a[i], MOD))%MOD;
        pn(ans);
    }
    long pow(long a, long p, long MOD){
        long o = 1;
        for(;p>0;p>>=1){
            if((p&1)==1)o = (o*a)%MOD;
            a = (a*a)%MOD;
        }
        return o;
    }
    //SOLUTION END
    void hold(boolean b)throws Exception{if(!b)throw new Exception("Hold right there, Sparky!");}
    void exit(boolean b){if(!b)System.exit(0);}
    //    long IINF = (long)1e15;
    final int INF = (int)1e9+2, MX = (int)2e6+5;
    DecimalFormat df = new DecimalFormat("0.00000000000");
    double PI = 3.141592653589793238462643383279502884197169399, eps = 1e-8;
    static boolean multipleTC = false, memory = false, fileIO = false;
    FastReader in;PrintWriter out;
    void run() throws Exception{
        long ct = System.currentTimeMillis();
        if (fileIO) {
            in = new FastReader("");
            out = new PrintWriter("");
        } else {
            in = new FastReader();
            out = new PrintWriter(System.out);
        }
        //Solution Credits: Taranpreet Singh
        int T = (multipleTC) ? ni() : 1;
        pre();
        for (int t = 1; t <= T; t++) solve(t);
        out.flush();
        out.close();
        System.err.println(System.currentTimeMillis() - ct);
    }
    public static void main(String[] args) throws Exception{
        if(memory)new Thread(null, new Runnable() {public void run(){try{new Main().run();}catch(Exception e){e.printStackTrace();}}}, "1", 1 << 28).start();
        else new Main().run();
    }
    int[][] make(int n, int[] from, int[] to, boolean f){
        int[][] g = new int[n][];int[]cnt = new int[n];
        for(int i:from)cnt[i]++;if(f)for(int i:to)cnt[i]++;
        for(int i = 0; i< n; i++)g[i] = new int[cnt[i]];
        for(int i = 0; i< from.length; i++){
            g[from[i]][--cnt[from[i]]] = to[i];
            if(f)g[to[i]][--cnt[to[i]]] = from[i];
        }
        return g;
    }
    int[][][] makeS(int n, int[] from, int[] to, boolean f){
        int[][][] g = new int[n][][];int[]cnt = new int[n];
        for(int i:from)cnt[i]++;if(f)for(int i:to)cnt[i]++;
        for(int i = 0; i< n; i++)g[i] = new int[cnt[i]][];
        for(int i = 0; i< from.length; i++){
            g[from[i]][--cnt[from[i]]] = new int[]{to[i], i};
            if(f)g[to[i]][--cnt[to[i]]] = new int[]{from[i], i};
        }
        return g;
    }
    int find(int[] set, int u){return set[u] = (set[u] == u?u:find(set, set[u]));}
    int digit(long s){int ans = 0;while(s>0){s/=10;ans++;}return ans;}
    long gcd(long a, long b){return (b==0)?a:gcd(b,a%b);}
    int gcd(int a, int b){return (b==0)?a:gcd(b,a%b);}
    int bit(long n){return (n==0)?0:(1+bit(n&(n-1)));}
    void p(Object o){out.print(o);}
    void pn(Object o){out.println(o);}
    void pni(Object o){out.println(o);out.flush();}
    String n()throws Exception{return in.next();}
    String nln()throws Exception{return in.nextLine();}
    int ni()throws Exception{return Integer.parseInt(in.next());}
    long nl()throws Exception{return Long.parseLong(in.next());}
    double nd()throws Exception{return Double.parseDouble(in.next());}

    class FastReader{
        BufferedReader br;
        StringTokenizer st;
        public FastReader(){
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        public FastReader(String s) throws Exception{
            br = new BufferedReader(new FileReader(s));
        }

        String next() throws Exception{
            while (st == null || !st.hasMoreElements()){
                try{
                    st = new StringTokenizer(br.readLine());
                }catch (IOException  e){
                    throw new Exception(e.toString());
                }
            }
            return st.nextToken();
        }

        String nextLine() throws Exception{
            String str;
            try{
                str = br.readLine();
            }catch (IOException e){
                throw new Exception(e.toString());
            }
            return str;
        }
    }
}


import java.math.BigInteger;
import java.util.*;
import java.io.*;
import java.text.*;
public class Main{
    //SOLUTION BEGIN
    //Into the Hardware Mode
    void pre() throws Exception{}
    void solve(int TC) throws Exception{
        int n = ni(), B = 20;
        long[] a = new long[1<<B];
        long MOD = (long)1e9+7;
        for(int i = 0; i< n; i++)a[ni()]++;
        for(int b = 0; b< B; b++)
            for(int i = 0; i< 1<<B; i++)
                if(((i>>b)&1)==1)
                    a[i^(1<<b)] += a[i];
        long ans = 0;
        for(int i = 0; i< a.length; i++)ans = (ans+MOD+(bit(i)%2 == 0?1:-1)*pow(2, a[i], MOD))%MOD;
        pn(ans);
    }
    long pow(long a, long p, long MOD){
        long o = 1;
        for(;p>0;p>>=1){
            if((p&1)==1)o = (o*a)%MOD;
            a = (a*a)%MOD;
        }
        return o;
    }
    //SOLUTION END
    void hold(boolean b)throws Exception{if(!b)throw new Exception("Hold right there, Sparky!");}
    void exit(boolean b){if(!b)System.exit(0);}
    //    long IINF = (long)1e15;
    final int INF = (int)1e9+2, MX = (int)2e6+5;
    DecimalFormat df = new DecimalFormat("0.00000000000");
    double PI = 3.141592653589793238462643383279502884197169399, eps = 1e-8;
    static boolean multipleTC = false, memory = false, fileIO = false;
    FastReader in;PrintWriter out;
    void run() throws Exception{
        long ct = System.currentTimeMillis();
        if (fileIO) {
            in = new FastReader("");
            out = new PrintWriter("");
        } else {
            in = new FastReader();
            out = new PrintWriter(System.out);
        }
        //Solution Credits: Taranpreet Singh
        int T = (multipleTC) ? ni() : 1;
        pre();
        for (int t = 1; t <= T; t++) solve(t);
        out.flush();
        out.close();
        System.err.println(System.currentTimeMillis() - ct);
    }
    public static void main(String[] args) throws Exception{
        if(memory)new Thread(null, new Runnable() {public void run(){try{new Main().run();}catch(Exception e){e.printStackTrace();}}}, "1", 1 << 28).start();
        else new Main().run();
    }
    int[][] make(int n, int[] from, int[] to, boolean f){
        int[][] g = new int[n][];int[]cnt = new int[n];
        for(int i:from)cnt[i]++;if(f)for(int i:to)cnt[i]++;
        for(int i = 0; i< n; i++)g[i] = new int[cnt[i]];
        for(int i = 0; i< from.length; i++){
            g[from[i]][--cnt[from[i]]] = to[i];
            if(f)g[to[i]][--cnt[to[i]]] = from[i];
        }
        return g;
    }
    int[][][] makeS(int n, int[] from, int[] to, boolean f){
        int[][][] g = new int[n][][];int[]cnt = new int[n];
        for(int i:from)cnt[i]++;if(f)for(int i:to)cnt[i]++;
        for(int i = 0; i< n; i++)g[i] = new int[cnt[i]][];
        for(int i = 0; i< from.length; i++){
            g[from[i]][--cnt[from[i]]] = new int[]{to[i], i};
            if(f)g[to[i]][--cnt[to[i]]] = new int[]{from[i], i};
        }
        return g;
    }
    int find(int[] set, int u){return set[u] = (set[u] == u?u:find(set, set[u]));}
    int digit(long s){int ans = 0;while(s>0){s/=10;ans++;}return ans;}
    long gcd(long a, long b){return (b==0)?a:gcd(b,a%b);}
    int gcd(int a, int b){return (b==0)?a:gcd(b,a%b);}
    int bit(long n){return (n==0)?0:(1+bit(n&(n-1)));}
    void p(Object o){out.print(o);}
    void pn(Object o){out.println(o);}
    void pni(Object o){out.println(o);out.flush();}
    String n()throws Exception{return in.next();}
    String nln()throws Exception{return in.nextLine();}
    int ni()throws Exception{return Integer.parseInt(in.next());}
    long nl()throws Exception{return Long.parseLong(in.next());}
    double nd()throws Exception{return Double.parseDouble(in.next());}

    class FastReader{
        BufferedReader br;
        StringTokenizer st;
        public FastReader(){
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        public FastReader(String s) throws Exception{
            br = new BufferedReader(new FileReader(s));
        }

        String next() throws Exception{
            while (st == null || !st.hasMoreElements()){
                try{
                    st = new StringTokenizer(br.readLine());
                }catch (IOException  e){
                    throw new Exception(e.toString());
                }
            }
            return st.nextToken();
        }

        String nextLine() throws Exception{
            String str;
            try{
                str = br.readLine();
            }catch (IOException e){
                throw new Exception(e.toString());
            }
            return str;
        }
    }
}


import java.util.Scanner;

/**
 * Created by David Lee on 2017/6/22.
 */

public class Main {
    static int P = 1000000007, N = 1<<20 + 5, k = 1<<20;
    static int a[] = new int [N];

    static private int ksm(int a, int b)
    {
        int c = 1, d = a;
        while (b > 0)
        {
            if((b & 1) != 0)
                c = (int)((long)c * d %P);
            d = (int)((long)d * d %P);
            b >>= 1;
        }
        return c;
    }

    static private void FWT(int [] a, int n, int L, int R)
    {
        if(L==R)
            return;
        int i, h = n/2;
        for (i = L; i < L + h; i++)
            a[i] = (a[i] + a[i+h])%P;
        FWT(a, h, L, L + h - 1);
        FWT(a, h, L + h, R);
    }

    static private void IFWT(int [] a, int n, int L, int R)
    {
        if(L==R)
            return;
        int i, h = n/2;
        for (i = L; i < L + h; i++)
            a[i] = (a[i] - a[i+h] + P)%P;
        IFWT(a, h, L, L + h - 1);
        IFWT(a, h, L + h, R);
    }

    static public void main(String args[]) {
        int T;
        Scanner Cin = new Scanner(System.in);
        //T = Cin.nextInt();
        T = 1;
        while (T > 0)
        {
            T--;
            int n, i;
            n = Cin.nextInt();
            for (i = 0; i < k; i++)
                a[i] = 0;
            for (i = 1; i <= n; i++)
                a[Cin.nextInt()]++;
            FWT(a, k, 0, k - 1);
            for (i = 0; i < 10; i++)
                System.out.printf("%d ",a[i]);
            System.out.println();
            for (i = 0; i < k; i++)
                a[i] = ksm(2, a[i]);
            IFWT(a, k, 0, k - 1);
            System.out.printf("%d\n", a[0]);
        }
    }
}


import java.util.Scanner;

/**
 * Created by David Lee on 2017/6/22.
 */

public class Main {
    static int P = 1000000007, N = 1<<20 + 5, k = 1<<20;
    static int a[] = new int [N];

    static private int ksm(int a, int b)
    {
        int c = 1, d = a;
        while (b > 0)
        {
            if((b & 1) != 0)
                c = (int)((long)c * d %P);
            d = (int)((long)d * d %P);
            b >>= 1;
        }
        return c;
    }

    static private void FWT(int [] a, int n, int L, int R)
    {
        if(L==R)
            return;
        int i, h = n/2;
        for (i = L; i < L + h; i++)
            a[i] = (a[i] + a[i+h])%P;
        FWT(a, h, L, L + h - 1);
        FWT(a, h, L + h, R);
    }

    static private void IFWT(int [] a, int n, int L, int R)
    {
        if(L==R)
            return;
        int i, h = n/2;
        for (i = L; i < L + h; i++)
            a[i] = (a[i] - a[i+h] + P)%P;
        IFWT(a, h, L, L + h - 1);
        IFWT(a, h, L + h, R);
    }

    static public void main(String args[]) {
        int T;
        Scanner Cin = new Scanner(System.in);
        T = Cin.nextInt();
        while (T > 0)
        {
            T--;
            int n, i;
            n = Cin.nextInt();
            for (i = 0; i < k; i++)
                a[i] = 0;
            for (i = 1; i <= n; i++)
                a[Cin.nextInt()]++;
            FWT(a, k, 0, k - 1);
            for (i = 0; i < 10; i++)
                System.out.printf("%d ",a[i]);
            System.out.println();
            for (i = 0; i < k; i++)
                a[i] = ksm(2, a[i]);
            IFWT(a, k, 0, k - 1);
            System.out.printf("%d\n", a[0]);
        }
    }
}


import java.util.Scanner;

/**
 * Created by David Lee on 2017/6/22.
 */

public class Main {
    static int P = 1000000007, N = 1<<20 + 5, k = 1<<20;
    static int a[] = new int [N];

    static private int ksm(int a, int b)
    {
        int c = 1, d = a;
        while (b > 0)
        {
            if((b & 1) != 0)
                c = (int)((long)c * d %P);
            d = (int)((long)d * d %P);
            b >>= 1;
        }
        return c;
    }

    static private void FWT(int [] a, int n, int L, int R)
    {
        if(L==R)
            return;
        int i, h = n/2;
        for (i = L; i < L + h; i++)
            a[i] = (a[i] + a[i+h])%P;
        FWT(a, h, L, L + h - 1);
        FWT(a, h, L + h, R);
    }

    static private void IFWT(int [] a, int n, int L, int R)
    {
        if(L==R)
            return;
        int i, h = n/2;
        for (i = L; i < L + h; i++)
            a[i] = (a[i] - a[i+h] + P)%P;
        IFWT(a, h, L, L + h - 1);
        IFWT(a, h, L + h, R);
    }

    static public void main(String args[]) {
        int T;
        Scanner Cin = new Scanner(System.in);
        //T = Cin.nextInt();
        T = 1;
        while (T > 0)
        {
            T--;
            int n, i;
            n = Cin.nextInt();
            for (i = 0; i < k; i++)
                a[i] = 0;
            for (i = 1; i <= n; i++)
                a[Cin.nextInt()]++;
            FWT(a, k, 0, k - 1);
            //for (i = 0; i < 10; i++)
                //System.out.printf("%d ",a[i]);
            //System.out.println();
            for (i = 0; i < k; i++)
                a[i] = ksm(2, a[i]);
            IFWT(a, k, 0, k - 1);
            System.out.printf("%d\n", a[0]);
        }
    }
}


import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Round257Div1D {

	public static long mod = (long)1e9+7;

	public static void solve() {
		int n = s.nextInt();
		int m = 20;
		int size = 1<<m;
		int[] dp = new int[size];
		for(int i = 0 ;i<n;i++) {
			int x = s.nextInt();
			dp[x]++;
		}
		for(int i=0;i<m;i++) {
			for(int mask = 0;mask<size;mask++) {
				if((mask & (1<<i))==0) {
					dp[mask]+=dp[mask|(1<<i)];
				}
			}
		}
		long ans = 0;
		for(int i=0;i<size;i++) {
			int bits = Integer.bitCount(i);
			if((bits&1)==0) {
				ans = ans + fast(2,dp[i]);
				ans%=mod;
			}else {
				ans = ans - fast(2,dp[i]);
				ans%=mod;
				if(ans<0) {
					ans+=mod;
				}
			}
		}
		out.println(ans);
	}

	public static long fast(long a,long n) {
		if(n == 1) {
			return a%mod;
		}else if(n==0) {
			return 1;
		}
		long ans= fast(a,n/2);
		ans = ans * ans;
		ans%=mod;
		if((n&1)==1) {
			ans = ans * a;
			ans%=mod;
		}
		return ans;
	}

	public static void main(String[] args) {
		out = new PrintWriter(new BufferedOutputStream(System.out));
		s = new FastReader();
		solve();
		out.close();
	}

	public static FastReader s;
	public static PrintWriter out;

	public static class FastReader {
		BufferedReader br;
		StringTokenizer st;

		public FastReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String next() {
			while (st == null || !st.hasMoreTokens()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

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

		double nextDouble() {
			return Double.parseDouble(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (Exception e) {
				e.printStackTrace();
			}
			return str;
		}
	}

}


import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Round257Div1D {

	public static long mod = (long)1e9+7;

	public static void solve() {
		int n = s.nextInt();
		int m = 20;
		int size = 1<<m;
		int[] dp = new int[size];
		for(int i = 0 ;i<n;i++) {
			int x = s.nextInt();
			dp[x]++;
		}
		for(int i=0;i<m;i++) {
			for(int mask = 0;mask<size;mask++) {
				if((mask & (1<<i))==0) {
					dp[mask]+=dp[mask|(1<<i)];
				}
			}
		}
		long ans = 0;
		for(int i=0;i<size;i++) {
			int bits = Integer.bitCount(i);
			if((bits&1)==0) {
				ans = ans + fast(2,dp[i]);
				ans%=mod;
			}else {
				ans = ans - fast(2,dp[i]);
				ans%=mod;
			}
		}
		out.println(ans);
	}

	public static long fast(long a,long n) {
		if(n == 1) {
			return a%mod;
		}else if(n==0) {
			return 1;
		}
		long ans= fast(a,n/2);
		ans = ans * ans;
		ans%=mod;
		if((n&1)==1) {
			ans = ans * a;
			ans%=mod;
		}
		return ans;
	}

	public static void main(String[] args) {
		out = new PrintWriter(new BufferedOutputStream(System.out));
		s = new FastReader();
		solve();
		out.close();
	}

	public static FastReader s;
	public static PrintWriter out;

	public static class FastReader {
		BufferedReader br;
		StringTokenizer st;

		public FastReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String next() {
			while (st == null || !st.hasMoreTokens()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

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

		double nextDouble() {
			return Double.parseDouble(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (Exception e) {
				e.printStackTrace();
			}
			return str;
		}
	}

}


import java.io.*;
import java.util.*;

public class D {

	BufferedReader br;
	PrintWriter out;
	StringTokenizer st;
	boolean eof;

	static final int LOG = 20;
	static final int N = 1 << LOG;
	static final int MOD = 1_000_000_007;

	void solve() throws IOException {
		int n = nextInt();
		int[] a = new int[N];
		for (int i = 0; i < n; i++) {
			int x = nextInt();
			a[N - 1 - x]++;
		}

		for (int i = 0; i < LOG; ++i)
			for (int mask = 0; mask < N; mask++)
				if (test(mask, i)) {
					a[mask] = (a[mask] + a[mask ^ (1 << i)]) % MOD;
				}

		for (int i = 0, j = N - 1; i < j; i++, j--) {
			int tmp = a[i];
			a[i] = a[j];
			a[j] = tmp;
		}

		int[] p2 = new int[n + 1];
		p2[0] = 1;
		for (int i = 0; i < n; i++) {
			p2[i + 1] = (p2[i] << 1) % MOD;
		}

		int ans = 0;

//		System.err.println(Arrays.toString(a));

		for (int i = 0; i < N; i++) {
			int val = p2[a[i]];
			if ((Integer.bitCount(i) & 1) == 0) {
				ans += val;
			} else {
				ans += MOD - val;
			}
			ans %= MOD;
		}

		out.println(ans);

	}

	static boolean test(int mask, int i) {
		return ((mask >> i) & 1) == 1;
	}

	D() throws IOException {
		br = new BufferedReader(new InputStreamReader(System.in));
		out = new PrintWriter(System.out);
		solve();
		out.close();
	}

	public static void main(String[] args) throws IOException {
		new D();
	}

	String nextToken() {
		while (st == null || !st.hasMoreTokens()) {
			try {
				st = new StringTokenizer(br.readLine());
			} catch (Exception e) {
				eof = true;
				return null;
			}
		}
		return st.nextToken();
	}

	String nextString() {
		try {
			return br.readLine();
		} catch (IOException e) {
			eof = true;
			return null;
		}
	}

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

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

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


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.FilterInputStream;
import java.io.BufferedInputStream;
import java.io.InputStream;

/**
 * @author khokharnikunj8
 */

public class Main {
    public static void main(String[] args) {
        new Thread(null, new Runnable() {
            public void run() {
                new Main().solve();
            }
        }, "1", 1 << 26).start();
    }

    void solve() {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        ScanReader in = new ScanReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        DJzzhuAndNumbers solver = new DJzzhuAndNumbers();
        solver.solve(1, in, out);
        out.close();
    }

    static class DJzzhuAndNumbers {
        public void solve(int testNumber, ScanReader in, PrintWriter out) {
            int n = in.scanInt();
            int[] ar = new int[n];
            long[] dp = new long[(1 << 20) | 5];
            for (int i = 0; i < n; i++)
                dp[(ar[i] = in.scanInt())]++;
            for (int i = 0; i < 20; i++) {
                for (int j = 0; j < (1 << 20); j++) {
                    if (((1 << i) & j) != 0) dp[j ^ (1 << i)] += dp[j];
                }
            }

            long mod = (1000000007);
            long ans = 0;
            for (int i = 0; i < (1 << 20); i++) {
                if (Integer.bitCount(i) % 2 == 1) {
                    ans -= (CodeHash.pow(2, dp[i], mod));
                    if (ans < 0) ans += mod;
                    if (ans >= mod) ans -= mod;
                } else {
                    ans += (CodeHash.pow(2, dp[i], mod));
                    if (ans < 0) ans += mod;
                    if (ans >= mod) ans -= mod;
                }
            }
            out.println(ans);
        }

    }

    static class CodeHash {
        public static long pow(long a, long b, long m) {
            long res = 1;
            a %= m;
            while (b > 0) {
                if ((b & 1) == 1) res = (res * a) % m;
                a = (a * a) % m;
                b >>= 1;
            }
            return res;
        }

    }

    static class ScanReader {
        private byte[] buf = new byte[4 * 1024];
        private int index;
        private BufferedInputStream in;
        private int total;

        public ScanReader(InputStream inputStream) {
            in = new BufferedInputStream(inputStream);
        }

        private int scan() {
            if (index >= total) {
                index = 0;
                try {
                    total = in.read(buf);
                } catch (Exception e) {
                    e.printStackTrace();
                }
                if (total <= 0) return -1;
            }
            return buf[index++];
        }

        public int scanInt() {
            int integer = 0;
            int n = scan();
            while (isWhiteSpace(n)) n = scan();
            int neg = 1;
            if (n == '-') {
                neg = -1;
                n = scan();
            }
            while (!isWhiteSpace(n)) {
                if (n >= '0' && n <= '9') {
                    integer *= 10;
                    integer += n - '0';
                    n = scan();
                }
            }
            return neg * integer;
        }

        private boolean isWhiteSpace(int n) {
            if (n == ' ' || n == '\n' || n == '\r' || n == '\t' || n == -1) return true;
            else return false;
        }

    }
}


import java.io.*;
import java.lang.*;
import java.util.*;

public class JzzuandNumbers{

	int n;
	int[]	arr;
	int[][]	dp;

	int[]	READER;
	void read()throws Exception{
		READER = new int[1000005];
		BufferedReader bi = new BufferedReader(new InputStreamReader(System.in));
		String line;
		int ind=0;
		while ((line = bi.readLine()) != null)
			for (String numStr: line.split("\\s"))
				READER[++ind] = Integer.parseInt(numStr);
	}

	long fe( long a,long b ){
		if( b==0 )	return	1;
		long t = fe(a,b/2);
		t = t*t%1000000007;
		if( (b&1)!=0 )	t = t*a%1000000007;
		return	t;
	}

	int	countbit( int x ){
		int	r=0;
		while( x!=0 ){
			r += (x&1);
			x >>= 1;
		}
		return	r;
	}

	void	solve()throws Exception{
		dp = new int[(1<<20)+2][22];
		arr =new int[1<<20];
		read();
		n = READER[1];
		for( int i=2;i<=n+1;i++ ){
			arr[i-1] = READER[i];
			dp[arr[i-1]][0]++;
		}
		for( int i=(1<<20)-1;i>=0;i-- )
			for( int k=0;k<20;k++ ){
				dp[i][k+1] += dp[i][k-1+1];
				if( (i&(1<<k))==0 && i+(1<<k)<=(1<<20)-1 )
					dp[i][k+1] += dp[i+(1<<k)][k-1+1];
			}
		long res=0;
		for( int i=0;i<(1<<20);i++ ){
			res += (fe( -1,countbit(i) )*( fe( 2,dp[i][20] )-1 )+1000000007)%1000000007;
		}
		System.out.println( (res%1000000007+1000000007)%1000000007 );
	}

	static	public	void	main( String args[] )throws Exception{
		new	JzzuandNumbers().solve();
	}

}


import java.io.*;
import java.lang.*;
import java.util.*;

public class JzzuandNumbers{

	int n;
	int[]	arr;
	int[][]	dp;

	int[]	READER;
	void read()throws Exception{
		READER = new int[1000005];
		BufferedReader bi = new BufferedReader(new InputStreamReader(System.in));
		String line;
		int ind=0;
		while ((line = bi.readLine()) != null)
			for (String numStr: line.split("\\s"))
				READER[++ind] = Integer.parseInt(numStr);
	}

	long fe( long a,long b ){
		if( b==0 )	return	1;
		long t = fe(a,b/2);
		t = t*t%1000000007;
		if( (b&1)!=0 )	t = t*a%1000000007;
		return	t;
	}

	int	countbit( int x ){
		int	r=0;
		while( x!=0 ){
			r += (x&1);
			x >>= 1;
		}
		return	r;
	}

	void	solve()throws Exception{
		dp = new int[(1<<20)+2][22];
		arr =new int[1<<20];
		read();
		n = READER[1];
		for( int i=2;i<=n+1;i++ ){
			arr[i-1] = READER[i];
			dp[arr[i-1]][0]++;
		}
		for( int i=(1<<20)-1;i>=0;i-- )
			for( int k=0;k<20;k++ ){
				dp[i][k+1] += dp[i][k-1+1];
				if( (i&(1<<k))==0 && i+(1<<k)<=(1<<20)-1 )
					dp[i][k+1] += dp[i+(1<<k)][k-1+1];
			}
		long res=0;
		for( int i=0;i<(1<<20);i++ ){
			res += fe( -1,countbit(i) )*( fe( 2,dp[i][20] )-1+1000000007 )%1000000007;
		}
		System.out.println( res%1000000007 );
	}

	static	public	void	main( String args[] )throws Exception{
		new	JzzuandNumbers().solve();
	}

}


import java.io.*;
import java.lang.*;
import java.util.*;

public class JzzuandNumbers{

	int n;
	int[]	arr;
	int[][]	dp;

	int[]	READER;
	void read()throws Exception{
		READER = new int[1000005];
		BufferedReader bi = new BufferedReader(new InputStreamReader(System.in));
		String line;
		int ind=0;
		while ((line = bi.readLine()) != null)
			for (String numStr: line.split("\\s"))
				READER[++ind] = Integer.parseInt(numStr);
	}

	long fe( long a,long b ){
		if( b==0 )	return	1;
		long t = fe(a,b/2);
		t = t*t%1000000007;
		if( (b&1)!=0 )	t = t*a%1000000007;
		return	t;
	}

	int	countbit( int x ){
		int	r=0;
		while( x!=0 ){
			r += (x&1);
			x >>= 1;
		}
		return	r;
	}

	void	solve()throws Exception{
		dp = new int[(1<<20)+2][22];
		arr =new int[1<<20];
		read();
		n = READER[1];
		for( int i=2;i<=n+1;i++ ){
			arr[i-1] = READER[i];
			dp[arr[i-1]][0]++;
		}
		for( int i=(1<<20)-1;i>=0;i-- )
			for( int k=0;k<20;k++ ){
				dp[i][k+1] += dp[i][k-1+1];
				if( (i&(1<<k))==0 && i+(1<<k)<=(1<<20)-1 )
					dp[i][k+1] += dp[i+(1<<k)][k-1+1];
			}
		long res=0;
		for( int i=0;i<(1<<20);i++ ){
			res += (fe( -1,countbit(i) )*( fe( 2,dp[i][20] )-1+1000000007 )+1000000007)%1000000007;
		}
		System.out.println( res%1000000007 );
	}

	static	public	void	main( String args[] )throws Exception{
		new	JzzuandNumbers().solve();
	}

}


import java.io.IOException;
import java.io.OutputStreamWriter;
import java.util.Arrays;
import java.io.BufferedWriter;
import java.util.InputMismatchException;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Writer;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author ilyakor
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        TaskD solver = new TaskD();
        solver.solve(1, in, out);
        out.close();
    }
}

class TaskD {
    static final int maxn = 1 << 18;
    static final int mod = 1000 * 1000 * 1000 + 7;

    public void solve(int testNumber, InputReader in, OutputWriter out) {
        int[] p2 = new int[maxn * 4];
        p2[0] = 1;
        for (int i = 1; i < p2.length; ++i)
            p2[i] = (p2[i - 1] * 2) % mod;

        int n = in.nextInt();
//        int n = 1000 * 1000;
        int[][] d = new int[4][maxn];
        for (int i = 0; i < n; ++i) {
            int x = in.nextInt();
//            int x = i;
            d[x % 4][x / 4] += 1;
        }
        int[] D = new int[maxn];
        long res = 0;
        for (int i = 0; i < maxn; ++i) {
            if (d[3][i] == 0) continue;
            addNum(D, i, d[3][i]);
        }
        res = p2[D[0]];
        int[] D_save = Arrays.copyOf(D, maxn);
        for (int i = 0; i < maxn; ++i) {
            if (d[2][i] == 0) continue;
            addNum(D, i, d[2][i]);
        }
        res = (res - p2[D[0]]) % mod;
        res = (res + mod) % mod;
        for (int i = 0; i < maxn; ++i) {
            if (d[1][i] == 0) continue;
            addNum(D, i, d[1][i]);
        }
        for (int i = 0; i < maxn; ++i) {
            if (d[0][i] == 0) continue;
            addNum(D, i, d[0][i]);
        }
        res = (res + p2[D[0]]) % mod;

        D = D_save;
        for (int i = 0; i < maxn; ++i) {
            if (d[1][i] == 0) continue;
            addNum(D, i, d[1][i]);
        }
        res = (res - p2[D[0]]) % mod;
        res = (res + mod) % mod;
//
//        for (int i = 0; i < maxn; ++i) {
//            for (int j = i; ; j = (j - 1) & i) {
//                D[j] += d[i];
//                if (j == 0) break;
//            }
//        }
//        for (int i = 0; i < maxn; ++i) {
//            int x = i;
//            long s = 1;
//            while (x > 0) {
//                if (x % 2 == 1) s = -s;
//                x /= 2;
//            }
//            res = (res + s * (long) p2[D[i]]) % mod;
//        }
        out.printLine(res);
    }

    static void addNum(int[] D, int x, int cnt) {
        for (int j = x; ; j = (j - 1) & x) {
            D[j] += cnt;
            if (j == 0) break;
        }
    }
}

class InputReader {
    private InputStream stream;
    private byte[] buffer = new byte[10000];
    private int cur;
    private int count;

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

    public static boolean isSpace(int c) {
        return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
    }

    public int read() {
        if (count == -1) {
            throw new InputMismatchException();
        }
        try {
            if (cur >= count) {
                cur = 0;
                count = stream.read(buffer);
                if (count <= 0)
                    return -1;
            }
        } catch (IOException e) {
            throw new InputMismatchException();
        }
        return buffer[cur++];
    }

    public int readSkipSpace() {
        int c;
        do {
            c = read();
        } while (isSpace(c));
        return c;
    }

    public int nextInt() {
        int sgn = 1;
        int c = readSkipSpace();
        if (c == '-') {
            sgn = -1;
            c = read();
        }
        int res = 0;
        do {
            if (c < '0' || c > '9') {
                throw new InputMismatchException();
            }
            res = res * 10 + c - '0';
            c = read();
        } while (!isSpace(c));
        res *= sgn;
        return res;
    }

}

class OutputWriter {
    private final PrintWriter writer;

    public OutputWriter(OutputStream outputStream) {
        writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
    }

    public OutputWriter(Writer writer) {
        this.writer = new PrintWriter(writer);
    }

    public void print(Object... objects) {
        for (int i = 0; i < objects.length; i++) {
            if (i != 0) {
                writer.print(' ');
            }
            writer.print(objects[i]);
        }
    }

    public void printLine(Object... objects) {
        print(objects);
        writer.println();
    }

    public void close() {
        writer.close();
    }

}


import java.io.IOException;
import java.io.OutputStreamWriter;
import java.util.Arrays;
import java.io.BufferedWriter;
import java.util.InputMismatchException;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Writer;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author ilyakor
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        TaskD solver = new TaskD();
        solver.solve(1, in, out);
        out.close();
    }
}

class TaskD {
    static final int maxn = 1 << 18;
    static final int mod = 1000 * 1000 * 1000 + 7;

    static int[] bcnt = new int[maxn];

    int[] p2;

    static {
        bcnt[0] = 0;
        for (int i = 1; i < maxn; ++i) {
            bcnt[i] = (i % 2) + bcnt[i / 2];
        }
    }

    public void solve(int testNumber, InputReader in, OutputWriter out) {
        p2 = new int[maxn * 4];
        p2[0] = 1;
        for (int i = 1; i < p2.length; ++i)
            p2[i] = (p2[i - 1] * 2) % mod;

        int n = in.nextInt();
//        int n = 1000 * 1000;
        int[][] d = new int[5][maxn];
        for (int i = 0; i < n; ++i) {
            int x = in.nextInt();
//            int x = i;
            d[x % 4][x / 4] += 1;
            if (x % 4 == 1 || x % 4 == 0)
                d[4][x / 4] += 1;
        }
        int[] D = new int[maxn];
        long res = 0;
        for (int i = 0; i < maxn; ++i) {
            if (d[3][i] == 0) continue;
            addNum(D, i, d[3][i]);
        }
        res = calc(D);
        int[] D_save = Arrays.copyOf(D, maxn);
        for (int i = 0; i < maxn; ++i) {
            if (d[2][i] == 0) continue;
            addNum(D, i, d[2][i]);
        }
        res = (res - calc(D)) % mod;
        res = (res + mod) % mod;
        for (int i = 0; i < maxn; ++i) {
            if (d[4][i] == 0) continue;
            addNum(D, i, d[4][i]);
        }
//        for (int i = 0; i < maxn; ++i) {
//            if (d[1][i] == 0) continue;
//            addNum(D, i, d[1][i]);
//        }
//        for (int i = 0; i < maxn; ++i) {
//            if (d[0][i] == 0) continue;
//            addNum(D, i, d[0][i]);
//        }
        res = (res + calc(D)) % mod;

        D = D_save;
        for (int i = 0; i < maxn; ++i) {
            if (d[1][i] == 0) continue;
            addNum(D, i, d[1][i]);
        }
        res = (res - calc(D)) % mod;
        res = (res + mod) % mod;
//
//        for (int i = 0; i < maxn; ++i) {
//            for (int j = i; ; j = (j - 1) & i) {
//                D[j] += d[i];
//                if (j == 0) break;
//            }
//        }
//        for (int i = 0; i < maxn; ++i) {
//            int x = i;
//            long s = 1;
//            while (x > 0) {
//                if (x % 2 == 1) s = -s;
//                x /= 2;
//            }
//            res = (res + s * (long) p2[D[i]]) % mod;
//        }
        out.printLine(res);
    }

    private long calc(int[] d) {
        long res = 0;
        for (int i = 0; i < maxn; ++i) {
            if (bcnt[i] % 2 == 0) {
                res += p2[d[i]];
                res %= mod;
            } else {
                res -= p2[d[i]];
                res %= mod;
                res += mod;
                res %= mod;
            }
        }
        return res;
    }

    static void addNum(int[] D, int x, int cnt) {
        for (int j = x; ; j = (j - 1) & x) {
            D[j] += cnt;
            if (j == 0) break;
        }
    }
}

class InputReader {
    private InputStream stream;
    private byte[] buffer = new byte[10000];
    private int cur;
    private int count;

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

    public static boolean isSpace(int c) {
        return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
    }

    public int read() {
        if (count == -1) {
            throw new InputMismatchException();
        }
        try {
            if (cur >= count) {
                cur = 0;
                count = stream.read(buffer);
                if (count <= 0)
                    return -1;
            }
        } catch (IOException e) {
            throw new InputMismatchException();
        }
        return buffer[cur++];
    }

    public int readSkipSpace() {
        int c;
        do {
            c = read();
        } while (isSpace(c));
        return c;
    }

    public int nextInt() {
        int sgn = 1;
        int c = readSkipSpace();
        if (c == '-') {
            sgn = -1;
            c = read();
        }
        int res = 0;
        do {
            if (c < '0' || c > '9') {
                throw new InputMismatchException();
            }
            res = res * 10 + c - '0';
            c = read();
        } while (!isSpace(c));
        res *= sgn;
        return res;
    }

}

class OutputWriter {
    private final PrintWriter writer;

    public OutputWriter(OutputStream outputStream) {
        writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
    }

    public OutputWriter(Writer writer) {
        this.writer = new PrintWriter(writer);
    }

    public void print(Object... objects) {
        for (int i = 0; i < objects.length; i++) {
            if (i != 0) {
                writer.print(' ');
            }
            writer.print(objects[i]);
        }
    }

    public void printLine(Object... objects) {
        print(objects);
        writer.println();
    }

    public void close() {
        writer.close();
    }

}


import java.io.*;
import java.math.BigInteger;
import java.util.*;

import static java.lang.Math.*;
import static java.math.BigInteger.*;
import static java.util.Arrays.*;

public class Main{
    public static void main(String[] args) {
        boolean isPrime = BigInteger.valueOf(1_000_000_007).isProbablePrime(50);
        System.err.println( "isPrime: " + isPrime );
    }
}


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 int[] pow2 = new int[1<<cntBits];
    {
        pow2[0] = 1;
        for (int i = 1; i < pow2.length; i++) {
            pow2[i] = (pow2[i-1] + pow2[i-1]);
            if( mod <= pow2[i] ) pow2[i] -= 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))];
                    if( mod <= f[msk] ) f[msk] -= 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);
//    }
}


import java.util.Scanner;

public class Main {
    private static final int mod = (int)1e9+7;
    public static void main(String[] args) {
        // TODO Auto-generated method stub
        try{

        Scanner sc = new Scanner(System.in);
        String input1 = sc.nextLine();
        String input2 = sc.nextLine();

        int n = Integer.parseInt(input1);

        String str1[] = input2.split(" ");
        int xs[] = new int[n];

        for(int i=0; i<str1.length; i++){
            xs[i] = Integer.parseInt(str1[i].trim());
        }

        int[] pow2 = new int[n+1];
        pow2[0] = 1;
        for(int i = 1; i < pow2.length; i++) pow2[i] = (int)(pow2[i-1] * 2L % mod);

        int[] dp = new int[1<<20];
        for(int x : xs) {
            dp[x]++;
        }

        for(int i = 0; i < 20; i++) {
            for(int j = 0; j < 1 << 20; j++) {
                if((j>>>i&1) == 0) {
                    dp[j] += dp[j|1<<i];
                }
            }
        }

        long ans = 0;
        for(int i = 0; i < 1 << 20; i++) {
            ans += (1L-Integer.bitCount(i)%2*2) * pow2[dp[i]]%mod;
        }

        System.out.println((ans % mod + mod) % mod);

        }
        catch(Exception e){
            e.printStackTrace();
        }
    }

}


import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		try{
		Scanner sc = new Scanner(System.in);
		String input1 = sc.nextLine();
		String input2 = sc.nextLine();

		int n = Integer.parseInt(input1);

		String str1[] = input2.split(" ");
		int numbers[] = new int[n];
		int zeroCount = 0;
		int nonZeroCount = 0;
		for(int i=0; i<str1.length; i++){
			numbers[i] = Integer.parseInt(str1[i].trim());
			if(numbers[i]==0){
				zeroCount++;
			}else{
				nonZeroCount++;
			}
		}
		//System.out.println("zeroCount:" + zeroCount);
		//System.out.println("nonZeroCount:" + nonZeroCount);

		if(zeroCount==0){
			System.out.println(0);
		}else if(zeroCount==1){
			System.out.println((int)(Math.pow(2, nonZeroCount)) % 1000000007);;
		}else if (zeroCount > 1){
			System.out.println((int)(Math.pow(2,nonZeroCount) - 1 + zeroCount)%1000000007);
		}

		}
		catch(Exception e){
			//e.printStackTrace();
		}
	}

}


import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        // TODO Auto-generated method stub
        try{
        Scanner sc = new Scanner(System.in);
        String input1 = sc.nextLine();
        String input2 = sc.nextLine();

        int n = Integer.parseInt(input1);

        String str1[] = input2.split(" ");
        int numbers[] = new int[n];

        for(int i=0; i<str1.length; i++){
            numbers[i] = Integer.parseInt(str1[i].trim());
        }

        int i = 0;
        int j=0;
        int res = 1;
        int count=0 ;
        for(i=0; i< numbers.length; i++){
            for(j=i; j< numbers.length; j++){
                res = res & numbers[j];
                if(res==0){
                    count++;
                }
            }
        }
        System.out.println(count % 1000000007);

        }
        catch(Exception e){
            e.printStackTrace();
        }
    }

}


#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<fstream>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<string>

using namespace std;

const int MAXN = 1<<20;
const long long MOD = 1000000007LL;
int f[MAXN];

long long POW(int u){
	if (u==0) return 1LL;
	long long v=1LL,w=2LL;
	for (;u>0;u>>=1){
		if (u&1) v=(v*w)%MOD;
		w=(w*w)%MOD;
	}
	return v;
}

int main(){
	int n;
	scanf("%d",&n);
	for (int i=0;i<n;++i){
		int k;
		scanf("%d",&k);
		++f[k];
	}
	for (int i=0;i<20;++i)
		for (int j=MAXN-1;j>=0;--j)
			if (j&(1<<i)) f[j^(1<<i)]+=f[j];
	long long sum=0;
	for (int i=0;i<MAXN;++i){
		int k=0;
		for (int j=0;j<20;++j)
			if (i&(1<<j)) ++k;
		if (k&1) sum-=POW(f[i])-1LL;
		else sum+=POW(f[i])-1LL;
	}
	sum%=MOD;
	printf("%d\n",(int)sum);
	return 0;
}


#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<fstream>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<string>

using namespace std;

const int MAXN = 1<<20;
const long long MOD = 1000000007LL;
int f[MAXN];

long long POW(int u){
	if (u==0) return 1LL;
	long long v=1LL,w=2LL;
	for (;u>0;u>>=1){
		if (u&1) v=(v*w)%MOD;
		w=(w*w)%MOD;
	}
	return v;
}

int main(){
	int n;
	scanf("%d",&n);
	for (int i=0;i<n;++i){
		int k;
		scanf("%d",&k);
		++f[k];
	}
	for (int i=0;i<20;++i)
		for (int j=MAXN-1;j>=0;--j)
			if (j&(1<<i)) f[j^(1<<i)]+=f[j];
	long long sum=0;
	for (int i=0;i<MAXN;++i){
		int k=0;
		for (int j=0;j<20;++j)
			if (i&(1<<j)) ++k;
		if (k&1) sum-=POW(f[i])-1LL;
		else sum+=POW(f[i])-1LL;
	}
	sum+=MOD<<3;
	sum%=MOD;
	cout << sum << endl;
	return 0;
}


#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<fstream>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<string>

using namespace std;

const int MAXN = 1<<20;
const long long MOD = 1000000007LL;
int f[MAXN];

long long POW(int u){
	if (u==0) return 1LL;
	long long v=1LL,w=2LL;
	for (;u>0;u>>=1){
		if (u&1) v=(v*w)%MOD;
		w=(w*w)%MOD;
	}
	return v;
}

int main(){
	int n;
	scanf("%d",&n);
	for (int i=0;i<n;++i){
		int k;
		scanf("%d",&k);
		++f[k];
	}
	for (int i=0;i<20;++i)
		for (int j=MAXN-1;j>=0;--j)
			if (j&(1<<i)) f[j^(1<<i)]+=f[j];
	long long sum=0;
	for (int i=0;i<MAXN;++i){
		int k=0;
		for (int j=0;j<20;++j)
			if (i&(1<<j)) ++k;
		if (k&1) sum-=POW(f[i])-1LL;
		else sum+=POW(f[i])-1LL;
	}
	sum+=MOD<<3;
	sum%=MOD;
	printf("%d\n",(int)sum);
	return 0;
}


#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<fstream>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<string>

using namespace std;

const int MAXN = 1<<20;
const long long MOD = 1000000007LL;
int f[MAXN];

long long POW(int u){
	if (u==0) return 1LL;
	long long v=1LL,w=2LL;
	for (;u>0;u>>=1){
		if (u&1) v=(v*w)%MOD;
		w=(w*w)%MOD;
	}
	return v;
}

int main(){
	int n;
	scanf("%d",&n);
	for (int i=0;i<n;++i){
		int k;
		scanf("%d",&k);
		++f[k];
	}
	for (int i=0;i<20;++i)
		for (int j=MAXN-1;j>=0;--j)
			if (j&(1<<i)) f[j^(1<<i)]+=f[j];
	long long sum=0;
	for (int i=0;i<MAXN;++i){
		int k=0;
		for (int j=0;j<20;++j)
			if (i&(1<<j)) ++k;
		if (k&1) sum-=POW(f[i])-1LL;
		else sum+=POW(f[i])-1LL;
	}
	sum+=MOD<<7;
	sum%=MOD;
	printf("%d\n",(int)sum);
	return 0;
}


#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<fstream>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<string>

using namespace std;

const int MAXN = 1<<20;
const long long MOD = 1000000007LL;
int f[MAXN];

long long POW(int u){
	if (u==0) return 1LL;
	long long v=1LL,w=2LL;
	for (;u>0;u>>=1){
		if (u&1) v=(v*w)%MOD;
		w=(w*w)%MOD;
	}
	return v;
}

int main(){
	int n;
	scanf("%d",&n);
	for (int i=0;i<n;++i){
		int k;
		scanf("%d",&k);
		++f[k];
	}
	for (int i=0;i<20;++i)
		for (int j=MAXN-1;j>=0;--j)
			if (j&(1<<i)) f[j^(1<<i)]+=f[j];
	long long sum=0;
	for (int i=0;i<MAXN;++i){
		int k=0;
		for (int j=0;j<20;++j)
			if (i&(1<<j)) ++k;
		if (k&1) sum-=POW(f[i])-1LL;
		else sum+=POW(f[i])-1LL;
	}
	sum%=MOD;
	sum+=MOD;
	sum%=MOD;
	printf("%d\n",(int)sum);
	return 0;
}


#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>

using std::ceil;
using std::max;

const int MAXL=1<<20,P=1e9+7;
int n,len;
int f[MAXL];
int bit_cnt[MAXL];

inline void FWT_and(int a[],int len,int type){
	for(int i=1;i<len;i<<=1){
		for(int j=0,step=i<<1;j<len;j+=step){
			for(int k=0,x,y;k<i;++k){
				x=a[j|k],y=a[j|k|i];
				a[j|k]=(x+(type*y%P+P)%P)%P;
			}
		}
	}
}

inline int IEP(){
	FWT_and(f,len,1);
	int ret=0;
	for(int i=0;i<len;++i){
		int tmp=(1<<f[i])-1;
		ret=(ret+(bit_cnt[i]&1 ? P-tmp:tmp))%P;
	}
	return ret;
}

inline void pre_cal(){
	for(int i=1;i<len;++i)
		bit_cnt[i]=bit_cnt[i>>1]+(i&1);
}

int main(){
	scanf("%d",&n);
	for(int i=1,x;i<=n;++i){
		scanf("%d",&x);
		len=max(len,x);
		++f[x];
	}
	len=1<<(int)ceil(log2(len))+(!(len&len-1));
	pre_cal();
	printf("%d",IEP());
	return 0;
}


#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>

using std::ceil;
using std::max;

const int MAXN=1e6+5,MAXL=1<<20,P=1e9+7;
int n,len;
int f[MAXL];
int pow2[MAXN],bit_cnt[MAXL];

inline void FWT_and(int a[],int len,int type){
	for(int i=1;i<len;i<<=1){
		for(int j=0,step=i<<1;j<len;j+=step){
			for(int k=0,x,y;k<i;++k){
				x=a[j|k],y=a[j|k|i];
				a[j|k]=(x+(type*y%P+P)%P)%P;
			}
		}
	}
}

inline int IEP(){
	FWT_and(f,len,1);
	int ret=0;
	for(int i=0;i<len;++i){
		int tmp=(pow2[f[i]]-1+P)%P;
		ret=(ret+(bit_cnt[i]&1 ? P-tmp:tmp))%P;
	}
	return ret;
}

inline void pre_cal(){
	pow2[0]=1;
	for(int i=1;i<=n;++i)
		pow2[i]=(pow2[i-1]<<1)%P;
	for(int i=1;i<len;++i)
		bit_cnt[i]=bit_cnt[i>>1]+(i&1);
}

int main(){
	scanf("%d",&n);
	for(int i=1,x;i<=n;++i){
		scanf("%d",&x);
		len=max(len,x);
		++f[x];
	}
	len=1<<(int)ceil(log2(len))+(!(len&len-1));
	pre_cal();
	printf("%d",IEP());
	return 0;
}


#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>

using std::ceil;
using std::max;

const int MAXN=1e6+5,MAXL=1<<20,P=1e9+7;
int n,len;
int f[MAXL];
int bit_cnt[MAXL];

inline void FWT_and(int a[],int len,int type){
	for(int i=1;i<len;i<<=1){
		for(int j=0,step=i<<1;j<len;j+=step){
			for(int k=0,x,y;k<i;++k){
				x=a[j|k],y=a[j|k|i];
				a[j|k]=(x+(type*y%P+P)%P)%P;
			}
		}
	}
}

inline int IEP(){
	FWT_and(f,len,1);
	int ret=0;
	for(int i=0;i<len;++i){
		int tmp=1<<f[i];
		ret=(ret+(bit_cnt[i]&1 ? P-tmp:tmp))%P;
	}
	return ret;
}

inline void pre_cal(){
	for(int i=1;i<len;++i)
		bit_cnt[i]=bit_cnt[i>>1]+(i&1);
}

int main(){
	scanf("%d",&n);
	for(int i=1,x;i<=n;++i){
		scanf("%d",&x);
		len=max(len,x);
		++f[x];
	}
	len=1<<(int)ceil(log2(len))+(!(len&len-1));
	pre_cal();
	printf("%d",IEP());
	return 0;
}


#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>

using std::ceil;
using std::max;

const int MAXL=1<<21,P=1e9+7;
int n,len;
int f[MAXL];
int bit_cnt[MAXL];

inline void FWT_and(int a[],int len,int type){
	for(int i=1;i<len;i<<=1){
		for(int j=0,step=i<<1;j<len;j+=step){
			for(int k=0,x,y;k<i;++k){
				x=a[j|k],y=a[j|k|i];
				a[j|k]=(x+(type*y%P+P)%P)%P;
			}
		}
	}
}

inline int IEP(){
	FWT_and(f,len,1);
	int ret=0;
	for(int i=0;i<len;++i){
		int tmp=1<<f[i];
		ret=(ret+(bit_cnt[i]&1 ? P-tmp:tmp))%P;
	}
	return ret;
}

inline void pre_cal(){
	for(int i=1;i<len;++i)
		bit_cnt[i]=bit_cnt[i>>1]+(i&1);
}

int main(){
	scanf("%d",&n);
	for(int i=1,x;i<=n;++i){
		scanf("%d",&x);
		len=max(len,x);
		++f[x];
	}
	len=1<<(int)ceil(log2(len))+(!(len&len-1));
	pre_cal();
	printf("%d",IEP());
	return 0;
}


#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
const int maxn=1000100;
const int N=(1<<20);
const int MOD=1e9+7;
int n,m,mx,cnt[maxn],f[21][maxn],po[maxn];
int main(){
	scanf("%d", &n);
	for(int i=0;i<n;i++){
		int k;scanf("%d", &k);
		cnt[k]++;mx=max(mx,k);
	}
	po[0]=1;
	for(int i=1;i<=n;i++) po[i]=((po[i-1])<<1)%MOD;
	for(m=1;(1<<m)<=mx;m++);
	int ans=0;
	for(int x=(1<<m)-1;x>=0;x--){
		if (x&1) f[0][x]=cnt[x];
		else f[0][x]=cnt[x]+cnt[x^1];
		for(int i=1;i<m;i++){
			if (x&(1<<i)) f[i][x]=f[i-1][x];
			else f[i][x]=(f[i-1][x]+f[i-1][x^(1<<i)])%(MOD-1);
		}
		int t=x,j=0;
		while(t) j+=t&1,t>>=1;
		if (j&1) ans=(ans-po[f[m-1][x]]%MOD+MOD)%MOD;
		else ans=(ans+po[f[m-1][x]])%MOD;
	}
	printf("%d\n", ans);
	return 0;
}


#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
const int maxn=1100000;
const int MOD=1e9+7;
int n,m,mx,cnt[maxn],f[21][maxn],po[maxn];
int main(){
	scanf("%d", &n);
	for(int i=0;i<n;i++){
		int k;scanf("%d", &k);
		cnt[k]++;mx=max(mx,k);
	}
	po[0]=1;
	for(int i=1;i<=n;i++) po[i]=((po[i-1])<<1)%MOD;
	for(m=1;(1<<m)<=mx;m++);
	int ans=0;
	for(int x=(1<<m)-1;x>=0;x--){
		if (x&1) f[0][x]=cnt[x];
		else f[0][x]=cnt[x]+cnt[x^1];
		for(int i=1;i<m;i++){
			if (x&(1<<i)) f[i][x]=f[i-1][x];
			else f[i][x]=(f[i-1][x]+f[i-1][x^(1<<i)])%(MOD-1);
		}
		int t=x,j=0;
		while(t) j+=t&1,t>>=1;
		if (j&1) ans=(ans-po[f[m-1][x]]%MOD+MOD)%MOD;
		else ans=(ans+po[f[m-1][x]])%MOD;
	}
	printf("%d\n", ans);
	return 0;
}


#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
const int maxn=1000100;
const int N=(1<<20);
const int MOD=1e9+7;
int n,m,mx,cnt[maxn],f[21][maxn],po[maxn];
int main(){
	scanf("%d", &n);
	for(int i=0;i<n;i++){
		int k;scanf("%d", &k);
		cnt[k]++;mx=max(mx,k);
	}
	po[0]=1;
	for(int i=1;i<=n;i++) po[i]=((po[i-1])<<1)%MOD;
	for(m=1;(1<<m)<=mx;m++);
	int ans=0;
	for(int x=(1<<m)-1;x>=0;x--){
		if (x&1) f[0][x]=cnt[x];
		else f[0][x]=cnt[x]+cnt[x^1];
		for(int i=1;i<m;i++){
			if (x&(1<<i)) f[i][x]=f[i-1][x];
			else f[i][x]=f[i-1][x]+f[i-1][x^(1<<i)];
		}
		int t=x,j=0;
		while(t) j+=t&1,t>>=1;
		if (j&1) ans=(ans-po[f[m-1][x]]%MOD+MOD)%MOD;
		else ans=(ans+po[f[m-1][x]])%MOD;
	}
	printf("%d\n", ans);
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pdd pair<double,double>
#define X first
#define Y second
#define REP(i,a) for(int i=0;i<a;++i)
#define REPP(i,a,b) for(int i=a;i<b;++i)
#define FILL(a,x) memset(a,x,sizeof(a))
#define	foreach( gg,itit )	for( typeof(gg.begin()) itit=gg.begin();itit!=gg.end();itit++ )
#define	mp make_pair
#define	pb push_back

inline int max(int a,int b){return a<b?b:a;}
inline int min(int a,int b){return a>b?b:a;}
inline ll max(ll a,ll b){return a<b?b:a;}
inline ll min(ll a,ll b){return a>b?b:a;}
const int mod = 1e9+7;
const int N = 1e6+10;
const ll INF = 1e18;

//#define DEBUG

#ifdef DEBUG
#define dprintf(fmt,...) fprintf(stderr,fmt,__VA_ARGS__)
#else
#define dprintf(fmt,...)
#endif

int arr[N]; ll a[1<<21],c[1<<20];
ll in[N];
ll power(ll x,ll y){
  ll t=1;
  while(y>0){
    if(y%2) y-=1,t=t*x%mod;
    else y/=2,x=x*x%mod;
  }
  return t;
}
int main(){
  int n; scanf("%d",&n);
  REP(i,n) {
    scanf("%d",&arr[i]); arr[i]=(1<<20)-1-arr[i];a[arr[i]]++;
  }
//  printf("%lld\n",power(3,5));
  //REPP(i,1,N) in[i]=power(i,mod-2);
  c[0]=1;
  REPP(i,1,N+1) c[i]=c[i-1]*2%mod;
  REP(i, 20) for(int j = (1 << 20) - 1; j >= 0; -- j)
    if(j >> i & 1)
      a[j] += a[j & ~(1 << i)];
  ll ans=0;
  REP(i,1<<20){
    int x=0;
    REP(j,20) if((i>>j)&1) x++;
    if(x%2==0) ans+=(c[a[i]]-1)%mod;
    else ans-=(c[a[i]]-1)%mod;
  }
  if(ans<0) ans+=mod;
  printf("%lld\n",(ans+mod)%mod);
  return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pdd pair<double,double>
#define X first
#define Y second
#define REP(i,a) for(int i=0;i<a;++i)
#define REPP(i,a,b) for(int i=a;i<b;++i)
#define FILL(a,x) memset(a,x,sizeof(a))
#define	foreach( gg,itit )	for( typeof(gg.begin()) itit=gg.begin();itit!=gg.end();itit++ )
#define	mp make_pair
#define	pb push_back

inline int max(int a,int b){return a<b?b:a;}
inline int min(int a,int b){return a>b?b:a;}
inline ll max(ll a,ll b){return a<b?b:a;}
inline ll min(ll a,ll b){return a>b?b:a;}
const int mod = 1e9+7;
const int N = 1e6+10;
const ll INF = 1e18;

//#define DEBUG

#ifdef DEBUG
#define dprintf(fmt,...) fprintf(stderr,fmt,__VA_ARGS__)
#else
#define dprintf(fmt,...)
#endif

int arr[N]; ll a[1<<21],c[1<<20];
ll in[N];
ll power(ll x,ll y){
  ll t=1;
  while(y>0){
    if(y%2) y-=1,t=t*x%mod;
    else y/=2,x=x*x%mod;
  }
  return t;
}
int main(){
  int n; scanf("%d",&n);
  REP(i,n) {
    scanf("%d",&arr[i]); arr[i]=(1<<20)-1-arr[i];a[arr[i]]++;
  }
//  printf("%lld\n",power(3,5));
  //REPP(i,1,N) in[i]=power(i,mod-2);
  c[0]=1;
  REPP(i,1,N+1) c[i]=c[i-1]*2%mod;
  REP(i, 20) for(int j = (1 << 20) - 1; j >= 0; -- j)
    if(j >> i & 1)
      a[j] += a[j & ~(1 << i)];
  ll ans=0;
  REP(i,1<<20){
    int x=0;
    REP(j,20) if((i>>j)&1) x++;
    if(x%2==0) ans+=(c[a[i]]-1)%mod;
    else ans-=(c[a[i]]-1)%mod;
  }
  printf("%lld\n",(ans+mod)%mod);
  return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pdd pair<double,double>
#define X first
#define Y second
#define REP(i,a) for(int i=0;i<a;++i)
#define REPP(i,a,b) for(int i=a;i<b;++i)
#define FILL(a,x) memset(a,x,sizeof(a))
#define	foreach( gg,itit )	for( typeof(gg.begin()) itit=gg.begin();itit!=gg.end();itit++ )
#define	mp make_pair
#define	pb push_back

inline int max(int a,int b){return a<b?b:a;}
inline int min(int a,int b){return a>b?b:a;}
inline ll max(ll a,ll b){return a<b?b:a;}
inline ll min(ll a,ll b){return a>b?b:a;}
const int mod = 1e9+7;
const int N = 1e6+10;
const ll INF = 1e18;

//#define DEBUG

#ifdef DEBUG
#define dprintf(fmt,...) fprintf(stderr,fmt,__VA_ARGS__)
#else
#define dprintf(fmt,...)
#endif

int arr[N]; ll a[1<<21],c[1<<20];
ll in[N];
ll power(ll x,ll y){
  ll t=1;
  while(y>0){
    if(y%2) y-=1,t=t*x%mod;
    else y/=2,x=x*x%mod;
  }
  return t;
}
int main(){
  int n; scanf("%d",&n);
  REP(i,n) {
    scanf("%d",&arr[i]); arr[i]=(1<<20)-1-arr[i];a[arr[i]]++;
  }
//  printf("%lld\n",power(3,5));
  //REPP(i,1,N) in[i]=power(i,mod-2);
  c[0]=1;
  REPP(i,1,N+10) c[i]=c[i-1]*2%mod;
  REP(i, 20) for(int j = (1 << 20) - 1; j >= 0; -- j)
    if(j >> i & 1)
      a[j] += a[j & ~(1 << i)];
  ll ans=0;
  REP(i,1<<20){
    int x=0;
    REP(j,20) if((i>>j)&1) x++;
    if(x%2==0) ans+=(c[a[i]]-1)%mod;
    else ans-=(c[a[i]]-1)%mod;
  }
  ans%=mod;
  if(ans<0) ans+=mod;
  printf("%lld\n",(ans+mod)%mod);
  return 0;
}


#include<iostream>
#include<stack>
#include<queue>
#include<cstdio>
#include<algorithm>
#include<vector>
#include<set>
#include<string>
#include<cstring>
#include<map>
#include<numeric>
#include<sstream>
#include<cmath>
using namespace std;

#define debug(x...) fprintf(stderr,x)
#define pb push_back
#define mp make_pair
#define f(i,x,y) for(int i=x; i<y; i++)
#define FORS(it,A) for(set<int>::iterator it = A.begin(); it!= A.end(); it++)
#define quad(x) ((x)*(x))
#define clr(x,y) memset(x,y,sizeof x)
#define all(x) ((x).begin(), (x).end())
#define fst first
#define snd second
#define sz(X) (int)X.size()
typedef pair<int,int> pii;
typedef long long ll;
typedef double ld;
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fll;

int pd[1<<20];
const ll mod = 1000000007ll;
int main() {
	int n; cin >> n;
	clr(pd, 0);
	f(i, 0, n) { int a; scanf("%d", &a); pd[a]++; }
	f(i, 0, 20) f(j, 0, (1<<n))
		if ((j & (1<<i)) == 0) pd[j] += pd[j | (1<<i)];
	ll resp = 0;
	f(i, 0, (1<<20)) {
		if (__builtin_popcount(i) & 1) resp = (resp + mod - (1LL<<pd[i])%mod) % mod;
		else resp = (resp + (1LL<<pd[i])) % mod;
	}
	cout << resp << endl;
	return 0;
}


#include<iostream>
#include<stack>
#include<queue>
#include<cstdio>
#include<algorithm>
#include<vector>
#include<set>
#include<string>
#include<cstring>
#include<map>
#include<numeric>
#include<sstream>
#include<cmath>
using namespace std;

#define debug(x...) fprintf(stderr,x)
#define pb push_back
#define mp make_pair
#define f(i,x,y) for(int i=x; i<y; i++)
#define FORS(it,A) for(set<int>::iterator it = A.begin(); it!= A.end(); it++)
#define quad(x) ((x)*(x))
#define clr(x,y) memset(x,y,sizeof x)
#define all(x) ((x).begin(), (x).end())
#define fst first
#define snd second
#define sz(X) (int)X.size()
typedef pair<int,int> pii;
typedef long long ll;
typedef double ld;
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fll;

int pd[1<<20];
const ll mod = 1000000007ll;
int main() {
	int n; cin >> n;
	clr(pd, 0);
	f(i, 0, n) { int a; scanf("%d", &a); pd[a]++; }
	f(i, 0, 20) f(j, 0, (1<<n))
		if ((j & (1<<i)) == 0) pd[j] += pd[j | (1<<i)];
	ll resp = 0;
	f(i, 0, 10) {
		if (__builtin_popcount(i) & 1) resp = (resp + mod - (1LL<<pd[i])%mod) % mod;
		else resp = (resp + (1LL<<pd[i])) % mod;
	}
	cout << resp << endl;
	return 0;
}


#include<iostream>
#include<stack>
#include<queue>
#include<cstdio>
#include<algorithm>
#include<vector>
#include<set>
#include<string>
#include<cstring>
#include<map>
#include<numeric>
#include<sstream>
#include<cmath>
using namespace std;

#define debug(x...) fprintf(stderr,x)
#define pb push_back
#define mp make_pair
#define f(i,x,y) for(int i=x; i<y; i++)
#define FORS(it,A) for(set<int>::iterator it = A.begin(); it!= A.end(); it++)
#define quad(x) ((x)*(x))
#define clr(x,y) memset(x,y,sizeof x)
#define all(x) ((x).begin(), (x).end())
#define fst first
#define snd second
#define sz(X) (int)X.size()
typedef pair<int,int> pii;
typedef long long ll;
typedef double ld;
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fll;

int pd[1<<20];
const ll mod = 1000000007ll;
ll pot2[1<<20];
int main() {
	int n; cin >> n;
	f(i, 0, (1<<20)) {
		pd[i] = 0;
		pot2[i] = (!i) ? 1LL : (pot2[i-1]*2LL) % mod;
	}
	f(i, 0, n) { int a; scanf("%d", &a); pd[a]++; }

	f(i, 0, 20) f(j, 0, (1<<n))
		if ((j & (1<<i)) == 0) pd[j] += pd[j | (1<<i)];
	ll resp = 0;
	f(i, 0, (1<<20)) {
		if (__builtin_popcount(i) & 1) resp = (resp + mod - pot2[pd[i]]) % mod;
		else resp = (resp + pot2[pd[i]]) % mod;
	}
	cout << resp << endl;
	return 0;
}