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;
const int bts = 20;
const int limit = 1 << bts;
class Buffer {
 public:
  Buffer(int _dim) {
    dim = _dim;
    data.resize(dim + 11);
    refill();
  }
  Buffer& operator>>(int& a) {
    while (!is_digit(data[pos]))
      if (++pos == dim) refill();
    a = 0;
    while (is_digit(data[pos])) {
      a = a * 10 + data[pos] - '0';
      if (++pos == dim) refill();
    }
    return *this;
  }

 private:
  int dim, pos;
  vector<char> data;
  bool is_digit(char c) { return '0' <= c && c <= '9'; }
  void refill() {
    memset(&data[0], 0, dim);
    fread(&data[0], 1, dim, stdin);
    pos = 0;
  }
};
int n, i, x;
long long data[limit];
void add(long long& a, long long b) {
  a += b;
  if (a >= 1000000007) a -= 1000000007;
}
void supraset() {
  int i, j;
  for (i = 0; i < bts; i++)
    for (j = 0; j < limit; j++)
      if ((j & (1 << i)) == 0) add(data[j], data[j ^ (1 << i)]);
}
long long poww(long long a, long long b) {
  long long ans = 1;
  while (b > 0) {
    if (b & 1) ans = (ans * a) % 1000000007;
    b >>= 1;
    a = (a * a) % 1000000007;
  }
  return ans;
}
void inv_supraset() {
  int i, j;
  for (i = 0; i < bts; i++)
    for (j = 0; j < limit; j++)
      if ((j & (1 << i)) == 0) add(data[j], 1000000007 - data[j ^ (1 << i)]);
}
int main() {
  Buffer fin(1 << 20);
  fin >> n;
  for (i = 1; i <= n; i++) fin >> x, data[x]++;
  supraset();
  for (i = 0; i < limit; i++) data[i] = poww(2, data[i]);
  inv_supraset();
  cout << data[0];
  return 0;
}