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 long long INF = 1LL << 60;
const double INFF = 1e100;
const double eps = 1e-8;
const int mod = 1000000007;
const int NN = 100005;
const int MM = 1000010;
int dp[20][1 << 20];
int a[1 << 20];
int q_pow(int x, int n, long long mod) {
  long long ans = 1, xx = x;
  for (; n > 0; n >>= 1) {
    if (n & 1) ans = ans * xx % mod;
    xx = xx * xx % mod;
  }
  return (int)ans;
}
int main() {
  int n, i, j, mask = 1 << 20;
  int ans, t, tt;
  scanf("%d", &n);
  for (i = 1; i <= n; i++) scanf("%d", &a[i]);
  memset(dp, 0, sizeof(dp));
  for (i = 1; i <= n; i++) {
    if (a[i] & 1) {
      dp[0][a[i]]++;
      dp[0][a[i] ^ 1]++;
    } else {
      dp[0][a[i]]++;
    }
  }
  for (i = 0; i < 19; i++)
    for (j = 0; j < mask; j++) {
      t = 1 << (i + 1);
      if (j & t) {
        dp[i + 1][j] += dp[i][j];
        dp[i + 1][j - t] += dp[i][j];
      } else {
        dp[i + 1][j] += dp[i][j];
      }
    }
  ans = 0;
  for (j = 0; j < mask; j++) {
    t = 1;
    for (i = 0; i < 20; i++)
      if ((1 << i) & j) t = -t;
    tt = q_pow(2, dp[19][j], mod);
    tt--;
    if (tt < 0) tt += mod;
    ans += t * tt;
    if (ans >= mod) ans -= mod;
    if (ans < 0) ans += mod;
  }
  printf("%d\n", ans);
  return 0;
}
