2
1 31
 2
1 0
 10
450661 128600 993228 725823 293549 33490 843121 903634 556169 448234
 1
1
 5
1 3 5 7 9
 6
524 529 5249 524 529 529
 3
1 2 3
 2
0 1
 55
0 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 2 3 4 5 6 7 8 9 3 4 5 6 7 8 9 4 5 6 7 8 9 5 6 7 8 9 6 7 8 9 7 8 9 8 9 9
 16
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
 3
128 1024 2048
 10
3 3 3 5 5 3 3 3 3 5
 1
0
 2
1 2
 2
0 0
 2
1 1

0
 2
 632
 0
 0
 24
 2
 2
 621247139
 64594
 4
 0
 1
 1
 3
 0

#include <bits/stdc++.h>
using namespace std;
const int N = 3e6 + 10;
const int mod = 1e9 + 7;
int gi() {
  int x = 0, o = 1;
  char ch = getchar();
  while ((ch < '0' || ch > '9') && ch != '-') ch = getchar();
  if (ch == '-') o = -1, ch = getchar();
  while (ch >= '0' && ch <= '9') x = x * 10 + ch - '0', ch = getchar();
  return x * o;
}
void FWT(int *a, int n) {
  for (int i = 1; i < n; i <<= 1)
    for (int p = i << 1, j = 0; j < n; j += p)
      for (int k = 0; k < i; k++) {
        int x = a[j + k], y = a[j + k + i];
        a[j + k + i] = x + y;
      }
}
void IFWT(int *a, int n) {
  for (int i = 1; i < n; i <<= 1)
    for (int p = i << 1, j = 0; j < n; j += p)
      for (int k = 0; k < i; k++) {
        int x = a[j + k], y = a[j + k + i];
        a[j + k + i] = y - x;
      }
}
int n, maxn = 0, a[N], f[N], g[N];
int q_pow(int a, int b) {
  int ret = 1;
  while (b) {
    if (b & 1) ret = 1ll * ret * a % mod;
    a = 1ll * a * a % mod;
    b >>= 1;
  }
  return ret;
}
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) a[i] = gi(), f[a[i]]++, maxn = max(maxn, a[i]);
  int N;
  for (N = 1; N <= maxn; N <<= 1)
    ;
  for (int i = 0; i < N; i++) g[i] = f[(~i) & (N - 1)];
  FWT(g, N);
  for (int i = 0; i < N; i++) f[i] = g[(~i) & (N - 1)];
  int ans = 0;
  for (int i = 1; i < N; i++)
    ans = ((ans + q_pow(-1, __builtin_popcount(i) + 1) * (q_pow(2, f[i]) - 1)) %
               mod +
           mod) %
          mod;
  ans = ((q_pow(2, n) - 1 - ans) % mod + mod) % mod;
  printf("%d\n", ans);
  return 0;
}
