Problem: You are given an array s of n non-negative integers.

A 5-tuple of integers (a, b, c, d, e) is said to be valid if it satisfies the following conditions: 

  * 1 ≤ a, b, c, d, e ≤ n
  * (sa | sb) & sc & (sd ^ se) = 2i for some integer i
  * sa & sb = 0



Here, '|' is the bitwise OR, '&' is the bitwise AND and '^' is the bitwise XOR operation.

Find the sum of f(sa|sb) * f(sc) * f(sd^se) over all valid 5-tuples (a, b, c, d, e), where f(i) is the i-th Fibonnaci number (f(0) = 0, f(1) = 1, f(i) = f(i - 1) + f(i - 2)).

Since answer can be is huge output it modulo 109 + 7.

Input

The first line of input contains an integer n (1 ≤ n ≤ 106).

The second line of input contains n integers si (0 ≤ si < 217).

Output

Output the sum as described above, modulo 109 + 7

Examples

Input

2
1 2


Output

32


Input

3
7 4 1


Output

3520


Input

10
1 3 0 7 3 7 6 5 7 5


Output

1235424


Input

10
50 9 11 44 39 40 5 39 23 7


Output

113860062

Solution (in JAVA):

Solution:
//package round458;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;

public class G {
	InputStream is;
	PrintWriter out;
	String INPUT = "";
	
	int mod = 1000000007;
	
//	long[] zeta(long[] a)
//	{
//		for(int i = 0;i < 17;i++){
//			for(int j = 0;j < 1<<17;j++){
//				if(j<<~i>=0){
//					a[j|1<<i] += a[j];
//				}
//			}
//		}
//		return a;
//	}
	
	
	long[] zetam(long[] a)
	{
		for(int i = 0;i < 17;i++){
			for(int j = 0;j < 1<<17;j++){
				if(j<<~i>=0){
					a[j] -= a[j|1<<i];
					if(a[j] < 0)a[j] += mod;
				}
			}
		}
		return a;
	}
	
	long[] and(long[] a, long[] b)
	{
		long[] ma = mobius(Arrays.copyOf(a, a.length));
		long[] mb = mobius(Arrays.copyOf(b, b.length));
		for(int i = 0;i < 1<<17;i++){
			ma[i] = ma[i] * mb[i] % mod;
		}
		return zetam(ma);
	}
	
	long[] mobius(long[] a)
	{
		for(int i = 0;i < 17;i++){
			for(int j = 0;j < 1<<17;j++){
				if(j<<~i>=0){
					a[j] += a[j|1<<i];
					if(a[j] >= mod)a[j] -= mod;
				}
			}
		}
		return a;
	}
	
	void solve()
	{
		int n = ni();
		int mod = 1000000007;
		long[] f = new long[1<<17];
		for(int i = 0;i < n;i++)f[ni()]++;
		
		int m = 1<<17;
		long[] ab = new long[m];
		for(int i = 0;i < 1<<17;i++){
			for(int j = m-1^i;j >= 0;j--){ j &= m-1^i; 
				ab[i|j] += f[i]*f[j];
			} // include j=0
		}
		
		long[] g = fwht(f);
		for(int i = 0;i < g.length;i++){
			g[i] = g[i] * g[i];
		}
		g = fwht(g);
		for(int i = 0;i < m;i++){
			g[i] >>>= 17;
		}
		
		long[] F = new long[m+1];
		F[0] = 0; F[1] = 1;
		for(int i = 2;i <= m;i++){
			F[i] = F[i-1] + F[i-2];
			F[i] %= mod;
		}
		
		for(int i = 0;i < m;i++){
			ab[i] = ab[i] % mod * F[i] % mod;
		}
		for(int i = 0;i < m;i++){
			g[i] = g[i] % mod * F[i] % mod;
		}
		for(int i = 0;i < m;i++){
			f[i] = f[i] * F[i] % mod;
		}
		
		long[] ret = and(and(ab, f), g);
		long ans = 0;
		for(int i = 1;i < 1<<17;i*=2){
			ans += ret[i];
		}
		out.println(ans%mod);
	}
	
	public static long[] fwht(long[] a)
	{
		int n = a.length;
		assert (n&n-1) == 0;
		a = Arrays.copyOf(a, n);
		for(int w = Integer.numberOfTrailingZeros(n)-1;w >= 0;w--){
			for(int i = 0;i < n;i++){
				if(i<<~w>=0){
					long nal = a[i]+a[i|1<<w];
					long nar = a[i]-a[i|1<<w];
					a[i] = nal; a[i|1<<w] = nar;
				}
			}
		}
		return a;
	}

	
	void run() throws Exception
	{
		is = oj ? System.in : new ByteArrayInputStream(INPUT.getBytes());
		out = new PrintWriter(System.out);
		
		long s = System.currentTimeMillis();
		solve();
		out.flush();
		tr(System.currentTimeMillis()-s+"ms");
	}
	
	public static void main(String[] args) throws Exception { new G().run(); }
	
	private byte[] inbuf = new byte[1024];
	public int lenbuf = 0, ptrbuf = 0;
	
	private int readByte()
	{
		if(lenbuf == -1)throw new InputMismatchException();
		if(ptrbuf >= lenbuf){
			ptrbuf = 0;
			try { lenbuf = is.read(inbuf); } catch (IOException e) { throw new InputMismatchException(); }
			if(lenbuf <= 0)return -1;
		}
		return inbuf[ptrbuf++];
	}
	
	private boolean isSpaceChar(int c) { return !(c >= 33 && c <= 126); }
	private int skip() { int b; while((b = readByte()) != -1 && isSpaceChar(b)); return b; }
	
	private double nd() { return Double.parseDouble(ns()); }
	private char nc() { return (char)skip(); }
	
	private String ns()
	{
		int b = skip();
		StringBuilder sb = new StringBuilder();
		while(!(isSpaceChar(b))){ // when nextLine, (isSpaceChar(b) && b != ' ')
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}
	
	private char[] ns(int n)
	{
		char[] buf = new char[n];
		int b = skip(), p = 0;
		while(p < n && !(isSpaceChar(b))){
			buf[p++] = (char)b;
			b = readByte();
		}
		return n == p ? buf : Arrays.copyOf(buf, p);
	}
	
	private char[][] nm(int n, int m)
	{
		char[][] map = new char[n][];
		for(int i = 0;i < n;i++)map[i] = ns(m);
		return map;
	}
	
	private int[] na(int n)
	{
		int[] a = new int[n];
		for(int i = 0;i < n;i++)a[i] = ni();
		return a;
	}
	
	private int ni()
	{
		int num = 0, b;
		boolean minus = false;
		while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
		if(b == '-'){
			minus = true;
			b = readByte();
		}
		
		while(true){
			if(b >= '0' && b <= '9'){
				num = num * 10 + (b - '0');
			}else{
				return minus ? -num : num;
			}
			b = readByte();
		}
	}
	
	private long nl()
	{
		long num = 0;
		int b;
		boolean minus = false;
		while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
		if(b == '-'){
			minus = true;
			b = readByte();
		}
		
		while(true){
			if(b >= '0' && b <= '9'){
				num = num * 10 + (b - '0');
			}else{
				return minus ? -num : num;
			}
			b = readByte();
		}
	}
	
	private boolean oj = System.getProperty("ONLINE_JUDGE") != null;
	private void tr(Object... o) { if(!oj)System.out.println(Arrays.deepToString(o)); }
}