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.Scanner;

/**
 * Created by David Lee on 2017/6/22.
 */

public class Main {
    static int P = 1000000007, N = 1<<20 + 5, k = 1<<20;
    static int a[] = new int [N];

    static private int ksm(int a, int b)
    {
        int c = 1, d = a;
        while (b > 0)
        {
            if((b & 1) != 0)
                c = (int)((long)c * d %P);
            d = (int)((long)d * d %P);
            b >>= 1;
        }
        return c;
    }

    static private void FWT(int [] a, int n, int L, int R)
    {
        if(L==R)
            return;
        int i, h = n/2;
        for (i = L; i < L + h; i++)
            a[i] = (a[i] + a[i+h])%P;
        FWT(a, h, L, L + h - 1);
        FWT(a, h, L + h, R);
    }

    static private void IFWT(int [] a, int n, int L, int R)
    {
        if(L==R)
            return;
        int i, h = n/2;
        for (i = L; i < L + h; i++)
            a[i] = (a[i] - a[i+h] + P)%P;
        IFWT(a, h, L, L + h - 1);
        IFWT(a, h, L + h, R);
    }

    static public void main(String args[]) {
        int T;
        Scanner Cin = new Scanner(System.in);
        //T = Cin.nextInt();
        T = 1;
        while (T > 0)
        {
            T--;
            int n, i;
            n = Cin.nextInt();
            for (i = 0; i < k; i++)
                a[i] = 0;
            for (i = 1; i <= n; i++)
                a[Cin.nextInt()]++;
            FWT(a, k, 0, k - 1);
            //for (i = 0; i < 10; i++)
                //System.out.printf("%d ",a[i]);
            //System.out.println();
            for (i = 0; i < k; i++)
                a[i] = ksm(2, a[i]);
            IFWT(a, k, 0, k - 1);
            System.out.printf("%d\n", a[0]);
        }
    }
}