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;
const int N = 3e6 + 10;
const int mod = 1e9 + 7;
int gi() {
  int x = 0, o = 1;
  char ch = getchar();
  while ((ch < '0' || ch > '9') && ch != '-') ch = getchar();
  if (ch == '-') o = -1, ch = getchar();
  while (ch >= '0' && ch <= '9') x = x * 10 + ch - '0', ch = getchar();
  return x * o;
}
void FWT(int *a, int n) {
  for (int i = 1; i < n; i <<= 1)
    for (int p = i << 1, j = 0; j < n; j += p)
      for (int k = 0; k < i; k++) {
        int x = a[j + k], y = a[j + k + i];
        a[j + k + i] = x + y;
      }
}
void IFWT(int *a, int n) {
  for (int i = 1; i < n; i <<= 1)
    for (int p = i << 1, j = 0; j < n; j += p)
      for (int k = 0; k < i; k++) {
        int x = a[j + k], y = a[j + k + i];
        a[j + k + i] = y - x;
      }
}
int n, maxn = 0, a[N], f[N], g[N];
int q_pow(int a, int b) {
  int ret = 1;
  while (b) {
    if (b & 1) ret = 1ll * ret * a % mod;
    a = 1ll * a * a % mod;
    b >>= 1;
  }
  return ret;
}
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) a[i] = gi(), f[a[i]]++, maxn = max(maxn, a[i]);
  int N;
  for (N = 1; N <= maxn; N <<= 1)
    ;
  for (int i = 0; i < N; i++) g[i] = f[(~i) & (N - 1)];
  FWT(g, N);
  for (int i = 0; i < N; i++) f[i] = g[(~i) & (N - 1)];
  int ans = 0;
  for (int i = 1; i < N; i++)
    ans = ((ans + q_pow(-1, __builtin_popcount(i) + 1) * (q_pow(2, f[i]) - 1)) %
               mod +
           mod) %
          mod;
  ans = ((q_pow(2, n) - 1 - ans) % mod + mod) % mod;
  printf("%d\n", ans);
  return 0;
}