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;
const int MOD = 1000000007;
int st[2000055], res[2000055];
int x, n;
int b[1000005];
int a[2000055], p[2000055];
int f[1000055][21];
int ansW[1000055];
int g[1000055][22];
int ger[1000005];
int add(int &x, int y) {
  x += y;
  if (x >= MOD) x -= MOD;
}
void precalc() {
  for (int i = 1000000; i >= 0; --i) {
    f[i][20] = a[i];
    for (int j = 20; j > 0; --j) {
      f[i][j - 1] += f[i][j];
      if (i & (1 << (j - 1))) f[i - (1 << (j - 1))][j - 1] += f[i][j];
    }
  }
  for (int i = 0; i <= 1000000; ++i) p[i] = f[i][0];
}
bool bit(int x, int y) {
  x = x & (1 << y);
  return (x > 0);
}
void solve() {
  int ret = 0;
  for (int i = 1; i < (1 << n); ++i) {
    int x = (1 << 20) - 1;
    for (int j = 0; j < n; ++j)
      if (bit(i, j)) x &= b[j];
    ansW[x]++;
    ret += (x == 0);
  }
  cout << ret << endl;
}
int main() {
  scanf("%d", &n);
  int mx = 0;
  for (int i = 0; i < n; ++i) {
    scanf("%d", &x);
    b[i] = x;
    if (x != 0) a[x]++;
    mx = max(mx, x + 1);
  }
  st[0] = 1;
  precalc();
  for (int i = 1; i <= 2 * n; ++i) st[i] = st[i - 1] * 2 % MOD;
  int ret = 1;
  for (int i = 0; i < n; ++i) add(ret, ret);
  int ans = 0;
  for (int i = mx; i >= 1; --i) {
    res[i] = (st[p[i]] - 1 + MOD) % MOD;
    for (int j = 0; j < 20; ++j)
      if (j % 2)
        res[i] = (res[i] + g[i][j]) % MOD;
      else
        res[i] = (res[i] - g[i][j] + MOD) % MOD;
    if (res[i] < 0) res[i] += MOD;
    g[i][20] = res[i];
    for (int j = 20; j > 0; --j) {
      g[i][j - 1] = (g[i][j - 1] - g[i][j] + MOD) % MOD;
      if (i & (1 << (j - 1)))
        g[i - (1 << (j - 1))][j - 1] =
            (g[i - (1 << (j - 1))][j - 1] - g[i][j] + MOD) % MOD;
    }
    ans = (ans + res[i]) % MOD;
    if (ans < 0) ans += MOD;
  }
  ret = (ret - 1 + MOD) % MOD;
  ret = ret - ans + MOD;
  ret %= MOD;
  printf("%d\n", ret);
  return 0;
}
