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;
template <class T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
ostream &operator<<(ostream &os, const vector<T> &t) {
  os << "[";
  for (__typeof((t).begin()) it = (t).begin(); it != (t).end(); it++) {
    if (it != t.begin()) os << ",";
    os << *it;
  }
  os << "]";
  return os;
}
template <class T>
ostream &operator<<(ostream &os, const set<T> &t) {
  os << "{";
  for (__typeof((t).begin()) it = (t).begin(); it != (t).end(); it++) {
    if (it != t.begin()) os << ",";
    os << *it;
  }
  os << "}";
  return os;
}
template <class S, class T>
ostream &operator<<(ostream &os, const pair<S, T> &t) {
  return os << "(" << t.first << "," << t.second << ")";
}
const int INF = 1 << 28;
const double EPS = 1e-8;
const int MOD = 1000000007;
int n;
int a[1 << 20], b[1 << 20];
long long int pow2[1000001];
int main() {
  pow2[0] = 1;
  for (int i = 0; i < (int)(1000000); i++) pow2[i + 1] = (pow2[i] * 2) % MOD;
  scanf("%d", &n);
  for (int i = 0; i < (int)(n); i++) {
    int x;
    scanf("%d", &x);
    b[x]++;
  }
  for (int i = 0; i < (int)(20); i++)
    for (int j = 0; j < (int)(1 << 20); j++)
      if (0 == (j & (1 << i))) b[j] += b[j | (1 << i)];
  for (int j = 0; j < (int)(1 << 20); j++)
    if (b[j]) printf("%d %lld\n", j, b[j]);
  long long int ans = 0;
  for (int j = 0; j < (int)(1 << 20); j++)
    (ans += pow2[b[j]] * (__builtin_popcount(j) % 2 ? -1 : 1)) %= MOD;
  printf("%lld\n", (ans + MOD) % MOD);
  return 0;
}
