Problem: Jzzhu have n non-negative integers a1, a2, ..., an. We will call a sequence of indexes i1, i2, ..., ik (1 ≤ i1 < i2 < ... < ik ≤ n) a group of size k. 

Jzzhu wonders, how many groups exists such that ai1 & ai2 & ... & aik = 0 (1 ≤ k ≤ n)? Help him and print this number modulo 1000000007 (109 + 7). Operation x & y denotes bitwise AND operation of two numbers.

Input

The first line contains a single integer n (1 ≤ n ≤ 106). The second line contains n integers a1, a2, ..., an (0 ≤ ai ≤ 106).

Output

Output a single integer representing the number of required groups modulo 1000000007 (109 + 7).

Examples

Input

3
2 3 3


Output

0


Input

4
0 1 2 3


Output

10


Input

6
5 2 0 5 2 1


Output

53

Solution (in JAVA):

Solution:
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());
	}
}