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;
void dbg(const char* fmt, ...) {}
const int P = int(1e9) + 7;
const int BITS = 20;
int solve(int n, int cur, int curAnd, const vector<vector<int> >& v,
          vector<int>& cnt, const vector<int>& pow2) {
  if (curAnd == 0) return pow2[n];
  if (cur == BITS) return 0;
  if (((1 << cur) & curAnd) == 0)
    return solve(n, cur + 1, curAnd, v, cnt, pow2);
  long long ans = 0;
  for (int i = 0; i < int(v[cur].size()); ++i) {
    int x = v[cur][i];
    int cntX = cnt[x];
    if (cntX == 0) continue;
    cnt[x] = 0;
    n -= cntX;
    (ans += long long(pow2[cntX] + P - 1) *
            solve(n, cur + 1, curAnd & x, v, cnt, pow2)) %= P;
  }
  return ans;
}
int main() {
  int n;
  scanf("%d", &n);
  vector<int> cnt(1 << BITS, 0);
  for (int i = 0; i < n; ++i) {
    int a;
    scanf("%d", &a);
    cnt[a]++;
  }
  vector<vector<int> > v(BITS);
  for (int i = 0; i < int(cnt.size()); ++i) {
    if (cnt[i] == 0) continue;
    for (int j = 0; j < BITS; ++j)
      if ((i & (1 << j)) == 0) v[j].push_back(i);
  }
  vector<int> pow2(n + 1);
  pow2[0] = 1;
  for (int i = 1; i <= n; ++i) pow2[i] = (pow2[i - 1] * 2) % P;
  printf("%d\n", solve(n, 0, (1 << BITS) - 1, v, cnt, pow2));
  return 0;
}
