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.BufferedReader;
import java.io.BufferedWriter;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;

import java.util.HashSet;

import java.util.StringTokenizer;




public class JzzhuAndNumbers {
	void log(Object o){

		//System.out.println(o);
			 output(o);

	}

	void info(Object o){
		System.out.println(o);
		//output(o);
	}

	void output(Object o){

		outputWln(""+o+"\n");

	}

	void outputWln(Object o){
		//		 System.out.print(o);

		try {
			out.write(""+ o);
		} catch (Exception e) {

		}

	}



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

	String nextLine(){
		try {
			return in.readLine();
		} catch (Exception e) {
		}
		return null;
	}

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


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


	}



	
	

	// Global vars
	StringTokenizer st;
	BufferedReader in;
	BufferedWriter out;
	int N;
	int[] A;
	long MOD=1000000007;
	
	void solveOld() {
		
		int MAX=1000001;
		
		long[] num=new long[MAX];
		long[] tmp=new long[MAX];
		HashSet<Integer> list=new HashSet<Integer>(MAX);
	
		for (int i=0;i<N;i++){
			HashSet<Integer> cmp=new HashSet<Integer>();
			Arrays.fill(tmp,0);
			cmp.add(A[i]);
			tmp[A[i]]++;
			for (int a:list){
				int b=a & A[i];
			//	log(" A:"+A[i]+" a:"+a+" b:"+b);
				tmp[b]+=num[a];
				if (tmp[b]>=MOD)
					tmp[b]%=MOD;
				cmp.add(b);
			}
			for (int b:cmp) {
				num[b]+=tmp[b];
				if (num[b]>=MOD)
					num[b]%=MOD;
			}
			list.addAll(cmp);
			
		}
		output(num[0]);
	}
	

	class Composite {
		int idx;
		int val;
	}
	
	void add(HashMap<Integer,Integer> hm,int x,int val){
	//	log("adding "+val+" to "+x);
		Integer z=hm.get(x);
		if (z==null)
			z=0;
		hm.put(x,z+val);
	}
	
	HashMap<Integer,Integer> solveRec(int l,int r){
	//	log("l:"+l+" r:"+r);
		HashMap<Integer,Integer> res=new HashMap<Integer,Integer>();
		if (r-l>1){
			int m=(l+r)/2;
			Set<Map.Entry<Integer,Integer>> X=solveRec(l,m).entrySet();
		//	log("X:"+X);
			Set<Map.Entry<Integer,Integer>> Y=solveRec(m+1,r).entrySet();
		//	log("Y:"+Y);
			
			for (Map.Entry<Integer,Integer> U:X) {
				int u=U.getKey();
				int nu=U.getValue();
				for (Map.Entry<Integer,Integer> V:Y){
					int v=V.getKey();
					int nv=V.getValue();
					int w=u & v;
					add(res,w,nu*nv);
				}
			}
			for (Map.Entry<Integer,Integer> U:X) {
				int u=U.getKey();
				int nu=U.getValue();
				add(res,u,nu);
			}
			
			for (Map.Entry<Integer,Integer> V:Y) {
				int v=V.getKey();
				int nv=V.getValue();
				add(res,v,nv);
			}
			
			
		//	log("res:"+res);
			return res;
		} else {
			add(res,A[l],1);
			if (r!=l) {
			add(res,A[r],1);
			add(res,A[l]&A[r],1);
			}
		}
		return res;
	}
	
	void solve() {
		
		int MAX=1000001;
		
		long[] num=new long[MAX];
		long[] tmp=new long[MAX];
		int[] used=new int[MAX];
		int[] inList=new int[MAX];
		ArrayList<Integer> list=new ArrayList<Integer>(MAX);
	
		for (int i=0;i<N;i++){
			ArrayList<Integer> cmp=new ArrayList<Integer>();
			Arrays.fill(tmp,0);
			cmp.add(A[i]);
			tmp[A[i]]++;
			used[A[i]]=i+1;
			int L=list.size();
			for (int j=0;j<L;j++){
				int a=list.get(j);
				int b=a & A[i];
			//	log(" A:"+A[i]+" a:"+a+" b:"+b);
				tmp[b]+=num[a];
				if (tmp[b]>=MOD)
					tmp[b]%=MOD;
				if (used[b]<i+1) {
					cmp.add(b);
					used[b]=i+1;
				}
				
			}
			for (int b:cmp) {
				num[b]+=tmp[b];
				if (num[b]>=MOD)
					num[b]%=MOD;
				if (inList[b]==0) {
					list.add(b);
					inList[b]=1;
				}
				
			}
		}
		output(num[0]);
	}
	
	void process() throws Exception {


		out = new BufferedWriter(new OutputStreamWriter(System.out));
		in=new BufferedReader(new InputStreamReader(System.in));

		N=nextInt();
		A=new int[N];
		for (int i=0;i<N;i++)
			A[i]=nextInt();
		HashMap<Integer,Integer> hm=solveRec(0,N-1);
		output(hm.get(0));
		//solve
		
		try {
			out.close();
		}
		catch (Exception e){}


	}



	public static void main(String[] args) throws Exception {
		JzzhuAndNumbers J=new JzzhuAndNumbers();


		J.process();


	}

}
