#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int x = 0, f = 1;
  char c = getchar();
  while (!isdigit(c)) {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (isdigit(c)) {
    x = (x << 1) + (x << 3) + c - 48;
    c = getchar();
  }
  return x * f;
}
const int N = 1e6 + 7;
const int mod = 1e9 + 7;
long long power(long long x, long long k) {
  long long ret = 1;
  if (x == 1) return 1;
  for (; k; k >>= 1, x = x * x % mod)
    if (k & 1) ret = ret * x % mod;
  return ret;
}
int getbit(int x) {
  int ret = 0;
  for (; x; x -= x & -x) ret++;
  return ret;
}
void Or(long long *f, int n, int x) {
  for (int k = 1; k < n; k <<= 1) {
    for (int i = 0; i < n; i += (k << 1)) {
      for (int j = 0; j < k; j++) {
        f[i + j + k] = (f[i + j + k] + f[i + j] * x + mod) % mod;
      }
    }
  }
}
void And(long long *f, int n, int x) {
  for (int k = 1; k < n; k <<= 1) {
    for (int i = 0; i < n; i += (k << 1)) {
      for (int j = 0; j < k; j++) {
        f[i + j] = (f[i + j] + f[i + j + k] * x + mod) % mod;
      }
    }
  }
}
void Xor(long long *f, int n, int x) {
  for (int k = 1; k < n; k <<= 1) {
    for (int i = 0; i < n; i += (k << 1)) {
      for (int j = 0; j < k; j++) {
        long long u = f[i + j], v = f[i + j + k];
        f[i + j] = (u + v) * x % mod;
        f[i + j + k] = (u - v + mod) * x % mod;
      }
    }
  }
}
long long c[1 << 18], c1[1 << 18], c2[1 << 18];
long long f[1 << 18];
long long t[18][1 << 18], g[18][1 << 18], bit[1 << 18];
int main() {
  int n = read();
  for (int i = 1; i <= n; i++) c[read()]++;
  n = 17;
  int len = 1 << n;
  f[0] = 0;
  f[1] = 1;
  for (int s = 2; s < len; s++) f[s] = (f[s - 1] + f[s - 2]) % mod;
  for (int s = 0; s < len; s++) {
    bit[s] = getbit(s);
    g[bit[s]][s] = c[s];
  }
  for (int i = 0; i <= n; i++) Or(g[i], len, 1);
  for (int i = 0; i <= n; i++) {
    for (int j = 0; j <= i; j++) {
      for (int k = 0; k < len; k++) {
        t[i][k] = (t[i][k] + g[j][k] * g[i - j][k]) % mod;
      }
    }
  }
  for (int i = 0; i <= n; i++) Or(t[i], len, -1);
  for (int k = 0; k < len; k++) c1[k] = t[bit[k]][k] * f[k] % mod;
  Xor(c, len, 1);
  for (int k = 0; k < len; k++) c2[k] = c[k] * c[k] % mod;
  Xor(c, len, power(2, mod - 2));
  Xor(c2, len, power(2, mod - 2));
  for (int k = 0; k < len; k++) c2[k] = c2[k] * f[k] % mod;
  for (int k = 0; k < len; k++) c[k] = c[k] * f[k] % mod;
  And(c, len, 1);
  And(c1, len, 1);
  And(c2, len, 1);
  for (int k = 0; k < len; k++) {
    c[k] = c[k] * c1[k] % mod;
    c[k] = c[k] * c2[k] % mod;
  }
  And(c, len, -1);
  long long ans = 0;
  for (int i = 0; i <= n; i++) {
    ans = (ans + c[1 << i]) % mod;
  }
  printf("%lld\n", (ans + mod) % mod);
  return 0;
}
