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 ll = long long;
const int C = 1000001, D = 21, M = 1000000007;
int elems[C], dp[C], bits[C][D], ij[C], leftmost[C], pw[D], superpow[C];
int main() {
  int n, i, j, jj, partial, r, a, v, A_size, full_A, full_B, sgn;
  ll res = 0;
  scanf("%d", &n);
  for (i = 0; i < n; i++) scanf("%d", &a), elems[a]++;
  leftmost[1] = 0, superpow[0] = pw[0] = 1;
  for (i = 2; i < C; i++) leftmost[i] = leftmost[i / 2] + 1;
  for (i = 1; i < D; i++) pw[i] = pw[i - 1] * 2;
  for (i = 1; i < C; i++) superpow[i] = (superpow[i - 1] * 2) % M;
  for (i = 1; i < C; i++) {
    v = i;
    while (v > 0) {
      bits[i][ij[i]] = leftmost[v];
      ij[i]++;
      v -= pw[leftmost[v]];
    }
  }
  for (i = C - 1; i > 0; i--) {
    A_size = ij[i] / 2;
    full_A = 0, full_B = 0;
    for (j = 0; j < A_size; j++) full_A += pw[bits[i][j]];
    for (j = A_size; j < ij[i]; j++) full_B += pw[bits[i][j]];
    partial = 0;
    while (true) {
      dp[partial + full_B] += elems[i];
      for (jj = 0; jj < A_size; jj++) {
        r = pw[bits[i][jj]];
        if ((partial & r) > 0)
          partial ^= r;
        else {
          partial = (partial | r);
          break;
        }
      }
      if (jj == A_size) break;
    }
    sgn = (((ij[i] - A_size) % 2 == 0) ? (-1) : 1);
    partial = 0;
    while (true) {
      elems[partial + full_A] += elems[i];
      for (jj = A_size; jj < ij[i]; jj++) {
        r = pw[bits[i][jj]];
        if ((partial & r) > 0)
          partial ^= r, sgn *= (-1);
        else {
          partial = (partial | r);
          sgn *= (-1);
          break;
        }
      }
      if (jj == ij[i] || partial == i) break;
    }
  }
  for (i = 0; i < C; i++)
    res = res + superpow[dp[i]] * ((ij[i] % 2 == 0) ? (-1) : 1);
  res = (superpow[n] - res) % M;
  if (res < 0) res += M;
  printf("%lld\n", res);
  return 0;
}
