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;
char buf[1 << 21], *p1 = buf, *p2 = buf;
template <class T>
void read(T &x) {
  x = 0;
  int c = getchar();
  int flag = 0;
  while (c < '0' || c > '9') flag |= (c == '-'), c = getchar();
  while (c >= '0' && c <= '9')
    x = (x << 3) + (x << 1) + (c ^ 48), c = getchar();
  if (flag) x = -x;
}
template <class T>
T _max(T a, T b) {
  return b < a ? a : b;
}
template <class T>
T _min(T a, T b) {
  return a < b ? a : b;
}
template <class T>
bool checkmax(T &a, T b) {
  return a < b ? a = b, 1 : 0;
}
template <class T>
bool checkmin(T &a, T b) {
  return b < a ? a = b, 1 : 0;
}
const int mod = 1000000000 + 7;
void add(int &a, int b) {
  a += b;
  (a >= mod) && (a -= mod);
}
void sub(int &a, int b) {
  a -= b;
  (a < 0) && (a += mod);
}
void mul(int &a, int b) { a = (long long)a * b % mod; }
int Add(int a, int b) {
  a += b;
  return a >= mod ? a - mod : a;
}
int Sub(int a, int b) {
  a -= b;
  return a < 0 ? a + mod : a;
}
int Mul(int a, int b) { return (long long)a * b % mod; }
int qpow(int a, int b) {
  int ans = 1;
  while (b) {
    if (b & 1) ans = (long long)ans * a % mod;
    a = (long long)a * a % mod;
    b >>= 1;
  }
  return ans;
}
int Inv(int a) { return qpow(a, mod - 2); }
const int N = 1000005;
int n;
int a[N], pw2[N];
int b[1 << 20];
void init() {
  read(n);
  pw2[0] = 1;
  for (int i = 1; i <= n; ++i) {
    pw2[i] = Add(pw2[i - 1], pw2[i - 1]);
    read(a[i]);
    ++b[a[i]];
  }
  for (int i = 0; i < 20; ++i) {
    for (int S = (1 << 20) - 1; S >= 0; --S)
      if (!(S >> i & 1)) {
        add(b[S], b[S | (1 << i)]);
      }
  }
  for (int i = 0; i < (1 << 20); ++i) {
    b[i] = pw2[b[i]];
  }
}
void solve() {
  for (int i = 0; i < 20; ++i) {
    for (int S = (1 << 20) - 1; S >= 0; --S)
      if (!(S >> i & 1)) {
        sub(b[S], b[S | (1 << i)]);
      }
  }
  printf("%d\n", b[0]);
}
int main() {
  init();
  solve();
  return 0;
}