#include <bits/stdc++.h>
using namespace std;
inline int getint() {
  int num = 0, flag = 1;
  char c;
  while ((c = getchar()) < '0' || c > '9')
    if (c == '-') flag = -1;
  while (c >= '0' && c <= '9') num = num * 10 + c - 48, c = getchar();
  return num * flag;
}
int n, len = 1 << 17, ans;
int a[1000005], b[1000005], c[1000005], d[18][1000005], e[18][1000005],
    f[1000005], cnt[1000005], s[1000005];
inline int upd(int x) { return x < 1000000007 ? x : x - 1000000007; }
inline void FWT_and(int *a, int len, int op) {
  for (int i = 1; i < len; i <<= 1)
    for (int j = 0; j < len; j += (i << 1))
      for (int k = 0; k < i; k++)
        if (~op)
          a[j + k] = upd(a[j + k] + a[i + j + k]);
        else
          a[j + k] = upd(a[j + k] + 1000000007 - a[i + j + k]);
}
inline void FWT_or(int *a, int len, int op) {
  for (int i = 1; i < len; i <<= 1)
    for (int j = 0; j < len; j += (i << 1))
      for (int k = 0; k < i; k++)
        if (~op)
          a[i + j + k] = upd(a[j + k] + a[i + j + k]);
        else
          a[i + j + k] = upd(a[i + j + k] + 1000000007 - a[j + k]);
}
inline void FWT_xor(int *a, int len, int op) {
  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 x = a[j + k], y = a[i + j + k];
        a[j + k] = upd(x + y), a[i + j + k] = upd(x + 1000000007 - y);
        if (!~op)
          a[j + k] = 1ll * a[j + k] * 500000004 % 1000000007,
                a[i + j + k] = 1ll * a[i + j + k] * 500000004 % 1000000007;
      }
}
int main() {
  n = getint();
  for (int i = 1; i <= n; i++) s[getint()]++;
  for (int i = 1; i < len; i++) cnt[i] = cnt[i >> 1] + (i & 1);
  f[1] = 1;
  for (int i = 2; i < len; i++) f[i] = upd(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++)
        e[i][k] = upd(e[i][k] + 1ll * d[j][k] * d[i - j][k] % 1000000007);
  for (int i = 0; i <= 17; i++) FWT_or(e[i], len, -1);
  for (int i = 0; i < len; i++) a[i] = 1ll * f[i] * e[cnt[i]][i] % 1000000007;
  for (int i = 0; i < len; i++) b[i] = 1ll * s[i] * f[i] % 1000000007;
  FWT_xor(s, len, 1);
  for (int i = 0; i < len; i++) c[i] = 1ll * s[i] * s[i] % 1000000007;
  FWT_xor(c, len, -1);
  for (int i = 0; i < len; i++) c[i] = 1ll * c[i] * f[i] % 1000000007;
  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] % 1000000007 * c[i] % 1000000007;
  FWT_and(a, len, -1);
  for (int i = 0; i < 17; i++) ans = upd(ans + a[1 << i]);
  printf("%d\n", ans);
}
