#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);
}
