#include <bits/stdc++.h>
using namespace std;
const int N = 1000050;
const int M = (1 << 17) + 50;
const int MOD = 1000000007;
const int inv_2 = (MOD + 1) / 2;
template <typename T>
inline void read(T& x) {
  T f = 1, c = 0;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    c = c * 10 + ch - '0';
    ch = getchar();
  }
  x = f * c;
}
template <typename T>
inline void Mod(T& x) {
  if (x >= MOD) x -= MOD;
}
int n, len = 1 << 17, s[M], a[M], b[M], c[M], d[20][M], e[20][M], f[M], cnt[M];
void fwt_xor(int* a, int len, int k) {
  for (int i = 1; i < len; i <<= 1)
    for (int j = 0; j < len; j += (i << 1))
      for (int o = 0; o < i; o++) {
        int w1 = a[j + o], w2 = a[j + o + i];
        Mod(a[j + o] = w1 + w2), Mod(a[j + o + i] = w1 + MOD - w2);
        if (k == -1)
          a[j + o] = 1ll * a[j + o] * inv_2 % MOD,
                a[j + o + i] = 1ll * a[j + o + i] * inv_2 % MOD;
      }
}
void fwt_or(int* a, int len, int k) {
  for (int i = 1; i < len; i <<= 1)
    for (int j = 0; j < len; j += (i << 1))
      for (int o = 0; o < i; o++) {
        if (k == 1)
          Mod(a[j + o + i] += a[j + o]);
        else
          Mod(a[j + o + i] += MOD - a[j + o]);
      }
}
void fwt_and(int* a, int len, int k) {
  for (int i = 1; i < len; i <<= 1)
    for (int j = 0; j < len; j += (i << 1))
      for (int o = 0; o < i; o++) {
        if (k == 1)
          Mod(a[j + o] += a[j + o + i]);
        else
          Mod(a[j + o] += MOD - a[j + o + i]);
      }
}
int main() {
  read(n);
  for (int x, i = 1; i <= n; i++) read(x), s[x]++;
  for (int i = 1; i < len; i++) cnt[i] = cnt[i - (i & -i)] + 1;
  f[1] = 1;
  for (int i = 2; i < len; i++) Mod(f[i] = f[i - 1] + f[i - 2]);
  for (int i = 0; i < len; i++) d[cnt[i]][i] = s[i];
  for (int i = 0; i <= 17; i++) fwt_or(d[i], len, 1);
  for (int i = 0; i <= 17; i++)
    for (int j = 0; j <= i; j++)
      for (int k = 0; k < len; k++)
        Mod(e[i][k] += 1ll * d[j][k] * d[i - j][k] % MOD);
  for (int i = 0; i <= 17; i++) fwt_or(e[i], len, -1);
  for (int i = 0; i < len; i++) a[i] = 1ll * e[cnt[i]][i] * f[i] % MOD;
  for (int i = 0; i < len; i++) b[i] = 1ll * s[i] * f[i] % MOD;
  fwt_xor(s, len, 1);
  for (int i = 0; i < len; i++) c[i] = 1ll * s[i] * s[i] % MOD;
  fwt_xor(c, len, -1);
  for (int i = 0; i < len; i++) c[i] = 1ll * c[i] * f[i] % MOD;
  fwt_and(a, len, 1), fwt_and(b, len, 1), fwt_and(c, len, 1);
  for (int i = 0; i < len; i++) a[i] = 1ll * a[i] * b[i] % MOD * c[i] % MOD;
  fwt_and(a, len, -1);
  int ans = 0;
  for (int i = 1; i < len; i <<= 1) Mod(ans += a[i]);
  printf("%d\n", ans);
  return 0;
}
