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;
int Set(int N, int pos) { return N = N | (1 << pos); }
int reset(int N, int pos) { return N = N & ~(1 << pos); }
bool check(int N, int pos) { return (bool)(N & (1 << pos)); }
long long po[1000000 + 5];
int dp[1000000 + 3][21], cnt[1000000 + 3];
int dp_func(int mask, int pos) {
  if (mask > 1000000) return 0;
  if (pos == -1) return cnt[mask];
  if (dp[mask][pos] != -1) return dp[mask][pos];
  int ret = 0;
  if (check(mask, pos) == 0) ret += dp_func(Set(mask, pos), pos - 1);
  ret += dp_func(mask, pos - 1);
  return dp[mask][pos] = ret;
}
int main() {
  int i, j, k, l, m, n;
  po[0] = 1;
  for (int i = 1; i <= 1000000; i++) {
    po[i] = po[i - 1] * 2;
    po[i] %= 1000000007;
  }
  memset(dp, -1, sizeof dp);
  scanf("%d", &n);
  int ma = 0;
  for (i = 1; i <= n; i++) {
    scanf("%d", &l);
    cnt[l]++;
    ma = max(ma, l);
  }
  long long ans = 0;
  for (int i = 0; i <= ma; i++) {
    int l = dp_func(i, 19);
    if (l == 0) continue;
    long long d = po[l] - 1;
    if (d < 0) d = (d + 1000000007) % 1000000007;
    if (__builtin_popcount(i) & 1)
      ans -= d;
    else
      ans += d;
    if (ans < 0) ans = (ans + 1000000007) % 1000000007;
    ans = ans % 1000000007;
  }
  cout << ans << endl;
}
