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

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

import java.io.*;
import 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();
	}

}
