#include <bits/stdc++.h>
// Useful stuff
template<int mod>
struct IntMod {
int value;
IntMod(int value_ = 0) : value(value_) { }
IntMod& operator+=(IntMod num) {
value += num.value;
if (value >= mod) value -= mod;
return *this;
}
IntMod& operator-=(IntMod num) {
value -= num.value;
if (value < 0) value += mod;
return *this;
}
IntMod operator*(IntMod num) const { return IntMod(int(1LL * value * num.value % mod)); }
IntMod operator+(IntMod num) const { return IntMod(*this) += num; }
IntMod operator-(IntMod num) const { return IntMod(*this) -= num; }
IntMod& operator*=(IntMod num) { return *this = *this * num; }
};
template<typename T>
T pow(T a, int n) {
T r(1);
while (n > 0) {
if (n & 1) {
r *= a;
}
a *= a;
n >>= 1;
}
return r;
}
const int mod = (int)1e9+7;
using Int = IntMod<mod>;
int main() {
std::ios_base::sync_with_stdio(false);
std::cin.tie(0);
// Input:
int n; std::cin >> n;
std::vector<int> arr(n);
for (auto &it : arr) {
std::cin >> it;
it = ~it & ((1 << 20) - 1); // inverting
}
// Counting numbers:
std::vector<int> cnt(1 << 20);
for (auto it : arr) {
cnt[it]++;
}
// DP over subsets:
auto dp = cnt;
for (int bit = 0; bit < 20; bit++) {
for (int mask = 0; mask < (1 << 20); mask++) {
if ((mask >> bit) & 1) {
dp[mask] += dp[mask ^ (1 << bit)];
}
}
}
// Calculating answer:
Int answ(1); // empty subset is correct
for (int mask = 0; mask < (1 << 20); mask++) {
// Every item, greater, than current, can be included or not: 2^cntGreater ways
auto fi = pow(Int(2), dp[mask] - cnt[mask]);
// At least 1 item, equal to `mask`, should be included: 2^cnt-1 ways
// Add a multiplication to answer
auto se = pow(Int(2), cnt[mask]) - 1;
answ += fi * se;
}
// Getting answer for given problem:
answ = pow(Int(2), n) - answ;
std::cout << answ.value << std::endl;
return 0;
}