#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;
}
