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;
using vi = vector<long long>;
using vvi = vector<vi>;
using P = pair<long long, long long>;
using PP = tuple<long long, long long, long long>;
using vp = vector<P>;
using vvp = vector<vp>;
template <class T>
void out(T a) {
  cout << a << '\n';
}
template <class T>
void outv(T v) {
  for (long long i = 0; i < (long long)(v.size()); i++) {
    if (i) cout << ' ';
    cout << v[i];
  }
  cout << '\n';
}
template <class T>
void outvv(T v) {
  for (long long i = 0; i < (long long)(v.size()); i++) outv(v[i]);
}
template <class T>
bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
const long long inf = 1001001001001001001;
const int mod = 1000000007;
long long modpow(long long a, long long b) {
  a %= mod;
  if (b == 0) return 1ll;
  if (b & 1) return a * modpow(a, b - 1) % mod;
  long long k = modpow(a, b / 2);
  return k * k % mod;
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  long long n, l = 20;
  cin >> n;
  vi v(1 << l);
  for (long long i = 0; i < (long long)(n); i++) {
    long long a;
    cin >> a;
    v[a ^ ((1 << l) - 1)]++;
  }
  vvi dp(1 << l, vi(l + 1));
  for (long long i = 0; i < (long long)(1 << l); i++) {
    dp[i][0] = v[i];
    for (long long j = 0; j < (long long)(l); j++) {
      dp[i][j + 1] += dp[i][j];
      if (i >> j & 1) dp[i][j + 1] += dp[i & ~(1 << j)][j];
    }
  }
  long long ans = 0;
  for (long long i = 0; i < (long long)(1 << l); i++) {
    long long c = __builtin_popcount(i);
    if (c & 1)
      ans -= modpow(2, dp[i][l]);
    else
      ans += modpow(2, dp[i][l]);
    ans %= mod;
  }
  ans += mod;
  out(ans % mod);
}
