2
1 31
 2
1 0
 10
450661 128600 993228 725823 293549 33490 843121 903634 556169 448234
 1
1
 5
1 3 5 7 9
 6
524 529 5249 524 529 529
 3
1 2 3
 2
0 1
 55
0 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 2 3 4 5 6 7 8 9 3 4 5 6 7 8 9 4 5 6 7 8 9 5 6 7 8 9 6 7 8 9 7 8 9 8 9 9
 16
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
 3
128 1024 2048
 10
3 3 3 5 5 3 3 3 3 5
 1
0
 2
1 2
 2
0 0
 2
1 1

0
 2
 632
 0
 0
 24
 2
 2
 621247139
 64594
 4
 0
 1
 1
 3
 0

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

import static java.lang.Math.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;

public class Main{
	
	// ArrayList<Integer> lis = new ArrayList<Integer>();
	// ArrayList<String> lis = new ArrayList<String>();
	//  PriorityQueue<P> que = new PriorityQueue<P>();
	// PriorityQueue<Integer> que = new PriorityQueue<Integer>();
	//  Stack<Integer> que = new Stack<Integer>();
    //	static long sum=0;
	// 1000000007 (10^9+7)
	static int mod = 1000000007;
	//static int mod = 1000000009,r=0; ArrayList<Integer> l[]= new ArrayList[n];
   // static int dx[]={1,-1,0,0};
//	static int dy[]={0,0,1,-1};
//	static int dx[]={1,-1,0,0,1,1,-1,-1};
//  static int dy[]={0,0,1,-1,1,-1,1,-1};
	//static Set<Integer> set = new HashSet<Integer>();p
	
public  static void main(String[] args)   throws Exception, IOException{
   //String line=""; throws Exception, IOException
   //(line=br.readLine())!=null
	//Scanner sc =new Scanner(System.in);
	// !!caution!! int long //  
	Reader sc = new Reader(System.in);


 //,a=sc.nextInt(),b=sc.nextInt();
 	 int n=sc.nextInt();
    long d[]=new long[2+(1<<20)]; 


	for (int i = 0; i <n ; i++){
		d[sc.nextInt()]++;
	}
	
	//for (int i = 1; i <21 ; i++)b[i]=(1<<i)-1;
	
	for(int t=19;-1<t;t--){
	for (int i =0 ; i < (1<<20) ; i++){
			d[ i ]= bit(i,t)?d[i] : d[i]+d[ i|(1<<t) ]; 
			d[i]%=mod;
		}
	}
	
	long r=0;
	
	for (int i =(1<<20)-1 ; -1 < i ; i--){
           int k=Integer.bitCount(i);
           if(k%2==1)k=-1; else k=1;
           r+=k*power(2,d[i],mod)+mod;
           r%=mod;
          // if( d[i]>0 )db(r,d[i],Integer.toBinaryString(i));
		}
	
	System.out.println(r);

}

static long power(long base, long exponent, long mod) {
	if (exponent == 0)
		return 1 % mod;
	long result = power(base, exponent >> 1, mod);
	result = result * result % mod;
	if ((exponent & 1) != 0)
		result = result * base % mod;
	return result;
}

static boolean bit(int x,int k){
	// weather k-th bit (from right) be one or zero
	return  ( 0 < ( (x>>k) & 1 )  )  ? true:false;
}
   


static void db(Object... os){
    System.err.println(Arrays.deepToString(os));

}

}


  /* 
   * class P implements Comparable<P>{
//		implements Comparable<Pair>
		int id; long d;
		P(int id,long d){
			this.id=id;
			this.d=d;
		} 
		public int compareTo(P x){
		   	 return  0<=d-x.d?1:-1 ;  //ascend
		   }
	 
 }



class Pair implements Comparable<Pair>{
//	implements Comparable<Pair>
	int a,b;
	Pair(int a,int b){
		this.a=a;
		this.b=b;
	} 
	public int compareTo(Pair x){
	   	 return a-x.a; //descend
	   }
}*/

class Reader
{ 
	private BufferedReader x;
	private StringTokenizer st;
	
	public Reader(InputStream in)
	{
		x = new BufferedReader(new InputStreamReader(in));
		st = null;
	}
	public String nextString() throws IOException
	{
		while( st==null || !st.hasMoreTokens() )
			st = new StringTokenizer(x.readLine());
		return st.nextToken();
	}
	public int nextInt() throws IOException
	{
		return Integer.parseInt(nextString());
	}
	public long nextLong() throws IOException
	{
		return Long.parseLong(nextString());
	}
	public double nextDouble() throws IOException
	{
		return Double.parseDouble(nextString());
	}
}
