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 N = 1 << 22, mod = 1e9 + 7;
inline int count(int x) { return __builtin_popcount(x); }
inline int mul(int a, int b) { return 1ll * a * b % mod; }
inline int sub(int a, int b) { return a - b >= 0 ? a - b : a - b + mod; }
inline int add(int a, int b) { return a + b >= mod ? a + b - mod : a + b; }
inline int power(int a, int b) {
  int res = 1;
  for (; b; b >>= 1) {
    if (b & 1) res = mul(res, a);
    a = mul(a, a);
  }
  return res;
}
namespace FWT {
inline void OR(int *f, int n, int type) {
  for (int mid = 1; mid < n; mid <<= 1)
    for (int j = 0; j < n; j += (mid << 1))
      for (int k = 0; k < mid; k++)
        f[j + k + mid] = add(f[j + k + mid], mul(f[j + k], type));
}
inline void AND(int *f, int n, int type) {
  for (int mid = 1; mid < n; mid <<= 1)
    for (int j = 0; j < n; j += (mid << 1))
      for (int k = 0; k < mid; k++)
        f[j + k] = add(f[j + k], mul(f[j + k + mid], type));
}
inline void XOR(int *f, int n, int type) {
  for (int mid = 1; mid < n; mid <<= 1)
    for (int j = 0; j < n; j += (mid << 1))
      for (int k = 0; k < mid; k++) {
        int x = f[j + k], y = f[j + k + mid];
        f[j + k] = add(x, y), f[j + k + mid] = sub(x, y),
              f[j + k] = mul(f[j + k], type),
              f[j + k + mid] = mul(f[j + k + mid], type);
      }
}
};  // namespace FWT
int n, f[N], Max;
int main() {
  scanf("%d", &n);
  for (int i = 1, x; i <= n; i++) {
    scanf("%d", &x);
    Max = max(Max, x);
    f[x]++;
  }
  int limit = 1;
  while (limit <= Max) limit <<= 1;
  f[limit - 1] += n;
  FWT::AND(f, limit, 1);
  for (int i = 0; i < limit; i++) {
    int val = sub(mul(2, n), f[i]);
    f[i] = power(2, n - val);
  }
  FWT::AND(f, limit, sub(mod, 1));
  cout << f[0] << endl;
  return 0;
}
