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;
int cnt[2000010];
inline int inn() {
  int x, ch;
  while ((ch = getchar()) < '0' || ch > '9')
    ;
  x = ch ^ '0';
  while ((ch = getchar()) >= '0' && ch <= '9')
    x = (x << 1) + (x << 3) + (ch ^ '0');
  return x;
}
inline void fwt(int *a, int n) {
  for (int i = 1; i < n; i <<= 1)
    for (int j = 0, p = i << 1; j < n; j += p)
      for (int k = 0; k < i; k++) (a[j + k] += a[j + k + i]) %= 1000000007;
}
inline int solve(int x, int s) {
  int res = 0;
  while (s) res ^= s & 1, s >>= 1;
  return res ? (1000000007 - x) % 1000000007 : x;
}
inline int fast_pow(int x, int k, int ans = 1) {
  for (; k; k >>= 1, x = (long long)x * x % 1000000007)
    (k & 1) ? ans = (long long)ans * x % 1000000007 : 0;
  return ans;
}
int main() {
  int n = inn(), A = 0, m = 1, ans = 0;
  for (int i = 1, x; i <= n; i++) cnt[x = inn()]++, A = max(A, x);
  while (m <= A) m <<= 1;
  fwt(cnt, m);
  for (int i = 0; i < m; i++)
    (ans += solve(fast_pow(2, cnt[i]), i)) %= 1000000007;
  if (!A) ans--;
  if (ans < 0) ans += 1000000007;
  return !printf("%d\n", ans);
}