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;
using vi = vector<long long>;
using vvi = vector<vi>;
using P = pair<long long, long long>;
using PP = tuple<long long, long long, long long>;
using vp = vector<P>;
using vvp = vector<vp>;
template <class T>
void out(T a) {
  cout << a << '\n';
}
template <class T>
void outv(T v) {
  for (long long i = 0; i < (long long)(v.size()); i++) {
    if (i) cout << ' ';
    cout << v[i];
  }
  cout << '\n';
}
template <class T>
void outvv(T v) {
  for (long long i = 0; i < (long long)(v.size()); i++) outv(v[i]);
}
template <class T>
bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
const long long inf = 1001001001001001001;
const int mod = 1000000007;
long long modpow(long long a, long long b) {
  a %= mod;
  if (b == 0) return 1ll;
  if (b & 1) return a * modpow(a, b - 1) % mod;
  long long k = modpow(a, b / 2);
  return k * k % mod;
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  long long n, l = 20;
  cin >> n;
  vi v(1 << l);
  for (long long i = 0; i < (long long)(n); i++) {
    long long a;
    cin >> a;
    v[a ^ ((1 << l) - 1)]++;
  }
  vvi dp(1 << l, vi(l + 1));
  for (long long i = 0; i < (long long)(1 << l); i++) {
    dp[i][0] = v[i];
    for (long long j = 0; j < (long long)(l); j++) {
      dp[i][j + 1] += dp[i][j];
      if (i >> j & 1) dp[i][j + 1] += dp[i & ~(1 << j)][j];
    }
  }
  long long ans = 0;
  for (long long i = 0; i < (long long)(1 << l); i++) {
    long long c = __builtin_popcount(i);
    if (c & 1)
      ans -= modpow(2, dp[i][l]);
    else
      ans += modpow(2, dp[i][l]);
    ans %= mod;
  }
  ans += mod;
  out(ans % mod);
}