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;
namespace Bit {
const int bcnt{20};
const int size{1 << bcnt};
const int full{size - 1};
inline int size_of(int n) {
  int r = 1;
  while (n >>= 1) r++;
  return r;
}
inline int count(int mask) { return __builtin_popcount(mask); }
inline int at(int mask, int b) { return mask >> b & 1; }
inline int flip(int mask) { return full ^ mask; }
inline int flip_b(int mask, int b) { return mask ^ (1 << b); }
inline int parity(int mask) { return __builtin_parity(mask); }
inline void print(int mask) {
  cout << "bitset<32>(mask)"
       << " = " << (bitset<32>(mask)) << "\n";
}
};  // namespace Bit
const int MOD = 1e9 + 7;
struct mint {
  int v;
  mint(int v = 0) : v(v){};
  inline bool operator==(const mint &b) { return v == b.v; }
  inline void operator+=(const mint &b) {
    if ((v += b.v) >= MOD) v -= MOD;
  }
  inline void operator-=(const mint &b) {
    if ((v += MOD - b.v) >= MOD) v -= MOD;
  }
  inline void operator*=(const mint &b) { v = v * 1ll * b.v % MOD; }
  inline mint operator^(int b) const {
    mint r{1};
    for (auto a = *this; b; b >>= 1) {
      if (b & 1) r *= a;
      a *= a;
    }
    return r;
  }
  inline mint inv() const { return operator^(MOD - 2); }
  inline void operator/=(const mint &b) { operator*=(b.inv()); }
};
inline mint operator+(const mint &a, const mint &b) {
  auto r = a;
  r += b;
  return r;
}
inline mint operator-(const mint &a, const mint &b) {
  auto r = a;
  r -= b;
  return r;
}
inline mint operator*(const mint &a, const mint &b) {
  auto r = a;
  r *= b;
  return r;
}
inline mint operator/(const mint &a, const mint &b) {
  auto r = a;
  r /= b;
  return r;
}
const int N = 1e6 + 7;
int a[N];
mint pw2[N];
static void glo_init() {
  pw2[0] = 1;
  for (int i = 1; i < N; i++) pw2[i] = pw2[i - 1] + pw2[i - 1];
}
int subcnt[Bit::size];
void solve() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n; i++) subcnt[Bit::flip(a[i])] += 1;
  for (int b = 0; b < Bit::bcnt; b++) {
    for (int mask = 0; mask < Bit::size; mask++) {
      if (!Bit::at(mask, b)) continue;
      subcnt[mask] += subcnt[Bit::flip_b(mask, b)];
    }
  }
  mint res = pw2[n];
  for (int mask = 1; mask < Bit::size; mask++) {
    int supcnt = subcnt[Bit::flip(mask)];
    bool is_positive = Bit::parity(mask) == false;
    if (is_positive)
      res += pw2[supcnt];
    else
      res -= pw2[supcnt];
  }
  cout << res.v << "\n";
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  glo_init();
  solve();
  return 0;
}
