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>
std::mt19937 rng(
    (int)std::chrono::steady_clock::now().time_since_epoch().count());
using namespace std;
long long mod = (1000000007LL);
inline long long Mod(long long a, long long b) { return (a % b); }
inline long long poww(long long a, long long b) {
  long long res = 1;
  while (b > 0) {
    if (b & 1) res = (res * a) % mod;
    a = (a * a) % mod;
    b >>= 1;
  }
  return res;
}
long long gcd(long long a, long long b) {
  while (b) {
    a %= b, swap(a, b);
  }
  return a;
}
void read(vector<int> &w, int n) {
  w.resize(n);
  for (int i = 0; i < n; i++) cin >> w[i];
}
void print(vector<int> &w) {
  for (int i = 0; i < (int)(w).size(); i++) {
    if (i == (int)(w).size() - 1)
      cout << w[i] << "\n";
    else
      cout << w[i] << " ";
  }
}
int prodmod(vector<int> w);
int summod(vector<int> w);
int n, m, q, k, v[1000050], ans;
pair<int, int> w[1000050];
string second;
int qtd[1000050], ini[1000050];
int32_t main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n;
  vector<long long> pot(1000050);
  pot[0] = 1;
  for (int i = 1; i < 1000050; i++) pot[i] = (2LL * pot[i - 1]) % mod;
  for (int i = 1; i <= n; i++) {
    cin >> v[i];
    qtd[v[i]]++;
  }
  for (int i = 0; i < 20; i++) {
    for (int mask = 0; mask < 1000050; mask++) {
      if ((mask & (1 << i)) or (mask ^ (1 << i)) >= 1000050) continue;
      qtd[mask] += qtd[mask ^ (1 << i)];
    }
  }
  long long ans = 0;
  for (int mask = 0; mask < 1000050; mask++) {
    qtd[mask] = pot[qtd[mask]] - 1;
    int tam = __builtin_popcount(mask) % 2;
    ans += (tam ? -1LL : 1LL) * qtd[mask];
    ans %= mod;
  }
  if (ans < 0) ans += mod;
  cout << ans % mod << "\n";
}
int summod(vector<int> w) {
  int curr = 0;
  for (int i = 0; i < (int)(w).size(); i++) {
    curr = (curr + w[i]) % mod;
    if (curr < 0) curr += mod;
  }
  return curr;
}
int prodmod(vector<int> w) {
  int curr = 1;
  for (int i = 0; i < (int)(w).size(); i++) {
    if (w[i] >= mod) w[i] %= mod;
    curr = (curr * w[i]) % mod;
    if (curr < 0) curr += mod;
  }
  return curr;
}