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;
inline long long mod(long long n, long long m) {
  long long ret = n % m;
  if (ret < 0) ret += m;
  return ret;
}
long long gcd(long long a, long long b) {
  return (b == 0LL ? a : gcd(b, a % b));
}
long long exp(long long a, long long b, long long m) {
  if (b == 0LL) return 1LL;
  if (b == 1LL) return mod(a, m);
  long long k = mod(exp(a, b / 2, m), m);
  if (b & 1LL) {
    return mod(a * mod(k * k, m), m);
  } else
    return mod(k * k, m);
}
const long long N = (1 << 20) + 5, L = 20;
const long long M = 1000000007;
long long a[N];
long long pot[(1 << 20) + 10];
long long F[(1 << 20) + 100];
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long n;
  cin >> n;
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
    F[a[i]]++;
  }
  long long full = (1LL << 20) - 1;
  for (long long i = 0; i < L; i++) {
    for (long long msk = 0; msk < (1 << 20); msk++) {
      if (msk & (1 << i)) F[msk ^ (1 << i)] += F[msk];
    }
  }
  pot[0] = 1;
  for (long long i = 1; i <= N; i++) pot[i] = (2LL * pot[i - 1]) % M;
  long long res = 0;
  for (long long i = 0; i < (1 << 20); i++) {
    if (__builtin_popcount(i) & 1) {
      res = (res - pot[F[i]]) % M;
    } else
      res = (res + pot[F[i]]) % M;
  }
  res %= M;
  if (res < 0) res += M;
  cout << res << "\n";
}