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;
auto Random_Address = [] {
  char* c;
  c = new char;
  delete c;
  return uint64_t(c);
};
uint64_t const SEED = chrono::steady_clock::now().time_since_epoch().count() *
                      (Random_Address() bitor 1);
mt19937 Rng(SEED);
constexpr int Mask(int i) { return 1 << i; }
constexpr int Getb(int x, int i) { return x >> i bitand 1; }
template <size_t N>
bitset<N> Bits(int x) {
  return bitset<N>(x);
}
template <class X, class Y>
bool minimize(X& x, Y const& y) {
  return y < x ? x = y, 1 : 0;
}
template <class X, class Y>
bool maximize(X& x, Y const& y) {
  return y > x ? x = y, 1 : 0;
}
int constexpr maxN = 1e6, mod_ = 1e9 + 7, maxA = 1e6;
int constexpr maxB = 20;
int N;
int a[maxN + 3];
int f[Mask(maxB) + 3];
int main() {
  cin.tie(nullptr)->sync_with_stdio(false);
  cin >> N;
  for (int i = 1; i <= N; i++) {
    cin >> a[i];
    ++f[a[i]];
  }
  for (int j = 0; j < maxB; j++)
    for (int i = Mask(maxB) - 1; i >= 0; i--)
      if (Getb(i, j)) f[i xor Mask(j)] += f[i];
  auto Add = [](int& x, int const& y) {
    x += y;
    if (x >= mod_) x -= mod_;
    return;
  };
  auto Sub = [](int& x, int const& y) {
    x -= y;
    if (x < 0) x += mod_;
    return;
  };
  auto Mul = [](int const& x, int const& y) {
    return static_cast<int>(static_cast<int64_t>(x) * y % mod_);
  };
  auto Pow = [](int x, int y) {
    int res = 1;
    for (; y; y >>= 1, x = static_cast<int64_t>(x) * x % mod_)
      if (y bitand 1) res = static_cast<int64_t>(res) * x % mod_;
    return res;
  };
  int res = 0;
  for (int i = 0; i < Mask(maxB); i++)
    if (__builtin_popcount(i) bitand 1)
      Sub(res, Pow(2, f[i]));
    else
      Add(res, Pow(2, f[i]));
  cout << res;
  return 0;
}