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>
using namespace std;
long long n;
long long mo = 1000000007;
long long dp[(1 << 20) + 5][25];
vector<long long> f, f1, f2;
long long power(long long x, unsigned long long y, long long p) {
  long long res = 1;
  x = x % p;
  if (x == 0) return 0;
  while (y > 0) {
    if (y & 1) res = (res * x) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}
vector<long long> sos(vector<long long> &v) {
  vector<long long> ans = v;
  for (long long i = 0; i < n; i++) {
    for (long long mask = 0; mask < (1 << n); mask++) {
      if (mask >> i & 1) {
        ans[mask] += ans[mask ^ (1 << i)];
        ans[mask] %= mo;
      }
    }
  }
  return ans;
}
vector<long long> combine(vector<long long> &a) {
  memset(dp, 0, sizeof(dp));
  vector<long long> ans(1 << n, 0);
  for (long long i = 0; i < (1 << n); i++) ans[i] = power(2, a[i], mo);
  for (long long mask = 0; mask < (1 << n); mask++) {
    dp[mask][-1] = 0;
    for (long long i = 0; i < n; i++) {
      dp[mask][i] = dp[mask][i - 1];
      if (mask >> i & 1) {
        dp[mask][i] += dp[mask ^ (1 << i)][i - 1];
        dp[mask][i] %= mo;
      }
    }
    ans[mask] = (ans[mask] - dp[mask][n - 1] + mo) % mo;
    dp[mask][-1] = ans[mask];
    for (long long i = 0; i < n; i++) {
      dp[mask][i] = dp[mask][i - 1];
      if (mask >> i & 1) {
        dp[mask][i] += dp[mask ^ (1 << i)][i - 1];
        dp[mask][i] %= mo;
      }
    }
  }
  return ans;
}
int32_t main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long m;
  cin >> m;
  n = 20;
  long long k = (1 << n);
  k--;
  f = f1 = f2 = vector<long long>(1 << n, 0);
  for (long long i = 0; i < m; i++) {
    long long x1;
    cin >> x1;
    x1 ^= k;
    f[x1]++;
  }
  long long req = 0;
  f1 = sos(f);
  f2 = combine(f1);
  cout << f2[k];
}