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 CPP):

Solution:
#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:500000000")
using namespace std;
const int mod = 1000000007;
int a[(1 << 20)], t2[(1 << 20) + 1], bitCount[(1 << 20)], c[(1 << 20)];
int main() {
  int n, i;
  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    c[a[i]]++;
  }
  t2[0] = 1;
  for (i = 1; i <= (1 << 20); i++) t2[i] = t2[i - 1] * 2 % mod;
  bitCount[1] = 1;
  for (i = 2; i < (1 << 20); i++) bitCount[i] = bitCount[i / 2] + (i & 1);
  for (int bit = 20 - 1; bit >= 0; bit--)
    for (int mask = 0; mask < (1 << 20); mask++)
      if (mask & (1 << bit)) c[mask ^ (1 << bit)] += c[mask];
  long long res = (t2[n] - 1 + mod) % mod;
  for (int mask = 1; mask < (1 << 20); mask++) {
    if (bitCount[mask] & 1)
      res = (res - (t2[c[mask]] - 1) + mod) % mod;
    else
      res = (res + (t2[c[mask]] - 1) + mod) % mod;
  }
  cout << res << endl;
}