#include <bits/stdc++.h>
using namespace std;
int n, m;
int fibo[200005], t[20][200005], f[20][200005], a[1000006], g[200005],
    h[200005], s[200005];
void FWT_or(int*, int, int);
void FWT_and(int*, int, int);
void FWT_xor(int*, int, int);
void init();
int main() {
  init();
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) {
    scanf("%d", a + i);
    int x = a[i], cnt = 0;
    m = max(m, x);
    for (int j = 0; j <= 17; ++j)
      if (x & (1 << j)) ++cnt;
    ++f[cnt][x];
    ++h[x];
    ++s[x];
  }
  int bit = 1, l = 1;
  while (bit <= m) bit <<= 1, ++l;
  for (int i = 0; i <= l; ++i) FWT_or(f[i], 1, bit);
  for (int i = 1; i <= l; ++i)
    for (int j = 0; j <= i; ++j)
      for (int k = 0; k < bit; ++k)
        t[i][k] = (1ll * t[i][k] + 1ll * f[j][k] * f[i - j][k] % 1000000007) %
                  1000000007;
  for (int i = 0; i <= l; ++i) {
    FWT_or(t[i], -1, bit);
    for (int j = 0; j < bit; ++j) {
      int cnt = 0;
      for (int k = 0; k <= l; ++k)
        if (j & (1 << k)) ++cnt;
      g[j] = (1ll * g[j] + t[i][j] * (cnt == i)) % 1000000007;
    }
  }
  FWT_xor(h, 1, bit);
  for (int i = 0; i < bit; ++i) h[i] = 1ll * h[i] * h[i] % 1000000007;
  FWT_xor(h, -1, bit);
  for (int i = 0; i < bit; ++i)
    s[i] = 1ll * fibo[i] * s[i] % 1000000007,
    g[i] = 1ll * fibo[i] * g[i] % 1000000007,
    h[i] = 1ll * fibo[i] * h[i] % 1000000007;
  FWT_and(h, 1, bit);
  FWT_and(g, 1, bit);
  FWT_and(s, 1, bit);
  for (int i = 0; i < bit; ++i)
    s[i] = 1ll * s[i] * g[i] % 1000000007 * h[i] % 1000000007;
  FWT_and(s, -1, bit);
  int ans = 0;
  for (int i = 1; i < bit; i <<= 1) ans = (1ll * ans + s[i]) % 1000000007;
  cout << ans << endl;
  return 0;
}
void FWT_or(int* x, int f, int len) {
  for (int i = 1; i < len; i <<= 1)
    for (int j = 0; j < len; j += i << 1)
      for (int k = 0; k < i; ++k)
        x[i + j + k] =
            (1ll * x[i + j + k] + x[j + k] * f + 1000000007) % 1000000007;
  return;
}
void FWT_and(int* x, int f, int len) {
  for (int i = 1; i < len; i <<= 1)
    for (int j = 0; j < len; j += i << 1)
      for (int k = 0; k < i; ++k)
        x[j + k] =
            (1ll * x[j + k] + x[i + j + k] * f + 1000000007) % 1000000007;
  return;
}
void FWT_xor(int* x, int f, int len) {
  for (int i = 1; i < len; i <<= 1)
    for (int j = 0; j < len; j += i << 1)
      for (int k = 0; k < i; ++k) {
        int p = x[j + k], q = x[i + j + k];
        x[j + k] = (1ll * p + q) % 1000000007;
        x[i + j + k] = (1ll * p - q + 1000000007) % 1000000007;
        if (f == -1)
          x[j + k] = 1ll * x[j + k] * 500000004 % 1000000007,
                x[i + j + k] = 1ll * x[i + j + k] * 500000004 % 1000000007;
      }
  return;
}
void init() {
  fibo[1] = fibo[2] = 1;
  for (int i = 3; i <= (1 << 17); ++i)
    fibo[i] = (1ll * fibo[i - 1] + fibo[i - 2]) % 1000000007;
  return;
}
