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 power(long long x, long long y, long long p) {
  long long res = 1;
  x = x % p;
  while (y > 0) {
    if (y & 1) {
      res = (res * x) % p;
    }
    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}
long long modInverse(long long a, long long p) { return power(a, p - 2, p); }
long long gcd(long long x, long long y) {
  if (x == 0 || y == 0) {
    return max(y, x);
  }
  return gcd(y % x, x);
}
long long a[1 << 20];
long long b[1 << 20];
long long powerb[1 << 20];
long long dp[1 << 20][21];
long long cnt[1 << 20];
int main() {
  long long n;
  scanf("%lld", &n);
  long long maxi = (1 << 20) - 1;
  for (long long i = 0; i < n; i++) {
    long long x;
    scanf("%lld", &x);
    a[maxi - x]++;
  }
  for (int i = 0; i < (1 << 20); ++i) b[i] = a[i];
  for (int i = 0; i < 20; ++i)
    for (int mask = 0; mask < (1 << 20); ++mask) {
      if (mask & (1 << i)) b[mask] += b[mask ^ (1 << i)];
    }
  for (long long i = 0; i < (1 << 20); i++) {
    powerb[i] = power(2LL, b[i], 1000000007);
  }
  for (long long mask = 0; mask < (1 << 20); mask++) {
    dp[mask][0] = 0;
    for (long long i = 1; i <= 20; i++) {
      if (mask & (1 << (i - 1)))
        dp[mask][i] = dp[mask][i - 1] + dp[mask ^ (1 << (i - 1))][i - 1];
      else
        dp[mask][i] = dp[mask][i - 1];
      dp[mask][i] %= 1000000007;
    }
    cnt[mask] = powerb[mask] - dp[mask][20];
    cnt[mask] += 1000000007;
    cnt[mask] %= 1000000007;
    dp[mask][0] = cnt[mask];
    for (long long i = 1; i <= 20; i++) {
      if (mask & (1 << (i - 1)))
        dp[mask][i] = dp[mask][i - 1] + dp[mask ^ (1 << (i - 1))][i - 1];
      else
        dp[mask][i] = dp[mask][i - 1];
      dp[mask][i] %= 1000000007;
    }
  }
  cout << cnt[maxi] << endl;
}