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>
std::mt19937 rng(
    (int)std::chrono::steady_clock::now().time_since_epoch().count());
using namespace std;
long long mod = (1000000007LL);
inline long long Mod(long long a, long long b) { return (a % b); }
inline long long poww(long long a, long long b) {
  long long res = 1;
  while (b > 0) {
    if (b & 1) res = (res * a) % mod;
    a = (a * a) % mod;
    b >>= 1;
  }
  return res;
}
long long gcd(long long a, long long b) {
  while (b) {
    a %= b, swap(a, b);
  }
  return a;
}
void read(vector<int> &w, int n) {
  w.resize(n);
  for (int i = 0; i < n; i++) cin >> w[i];
}
void print(vector<int> &w) {
  for (int i = 0; i < (int)(w).size(); i++) {
    if (i == (int)(w).size() - 1)
      cout << w[i] << "\n";
    else
      cout << w[i] << " ";
  }
}
int prodmod(vector<int> w);
int summod(vector<int> w);
int n, m, q, k, v[1000050], ans;
pair<int, int> w[1000050];
string second;
int qtd[1000050];
int32_t main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n;
  vector<int> pot(1000050);
  pot[0] = 1;
  for (int i = 1; i < 1000050; i++) pot[i] = (2LL * pot[i - 1]) % mod;
  for (int i = 1; i <= n; i++) {
    cin >> v[i];
    qtd[v[i]]++;
  }
  for (int mask = 1000050 - 1; mask >= 0; mask--) {
    for (int j = 0; j < 20; j++) {
      if (mask & (1 << j)) continue;
      for (int i = j + 1; i < 20; i++) {
        if (!(mask & (1 << i)) and !(mask & (1 << j))) {
          if ((mask ^ (1 << i) ^ (1 << j)) < 1000050) {
            qtd[mask] -= 1LL * qtd[mask ^ (1 << i) ^ (1 << j)];
            if (qtd[mask] < 0) {
              qtd[mask] += mod;
            }
          }
        }
      }
    }
    for (int j = 0; j < 20; j++) {
      if (mask & (1 << j)) {
        qtd[mask ^ (1 << j)] += qtd[mask];
        if (qtd[mask ^ (1 << j)] > mod) qtd[mask ^ (1 << j)] -= mod;
      }
    }
  }
  long long ans = 0;
  for (int mask = 0; mask < 30; mask++) {
    qtd[mask] = pot[qtd[mask]] - 1;
    int tam = __builtin_popcount(mask) % 2;
    ans += (tam ? -1LL : 1LL) * qtd[mask];
    if (ans < 0) ans += mod;
    if (ans > mod) ans -= mod;
  }
  cout << ans << "\n";
}
int summod(vector<int> w) {
  int curr = 0;
  for (int i = 0; i < (int)(w).size(); i++) {
    curr = (curr + w[i]) % mod;
    if (curr < 0) curr += mod;
  }
  return curr;
}
int prodmod(vector<int> w) {
  int curr = 1;
  for (int i = 0; i < (int)(w).size(); i++) {
    if (w[i] >= mod) w[i] %= mod;
    curr = (curr * w[i]) % mod;
    if (curr < 0) curr += mod;
  }
  return curr;
}
