#include <bits/stdc++.h>
using namespace std;
int s[1000005], maxx, n, m, cnt[300000];
long long fib[300000], a[20][300000], b[20][300000], c[300000], d[300000],
    e[300000], f[20][300000], ans;
void fwt_xor(long long *a, int f) {
  for (int i = 1; i < m; i <<= 1)
    for (int j = 0; j < m; j += (i << 1))
      for (int k = 0; k < i; k++) {
        long long x = a[j + k], y = a[i + j + k];
        a[j + k] = (x + y) % 1000000007;
        a[i + j + k] = ((x - y) % 1000000007 + 1000000007) % 1000000007;
        if (f < 0)
          a[j + k] = a[j + k] * 500000004 % 1000000007,
                a[i + j + k] = a[i + j + k] * 500000004 % 1000000007;
      }
}
void fwt_or(long long *a, int f) {
  for (int i = 1; i < m; i <<= 1)
    for (int j = 0; j < m; j += (i << 1))
      for (int k = 0; k < i; k++) {
        long long x = a[j + k], y = a[i + j + k];
        if (f > 0) a[j + k] = x, a[i + j + k] = (x + y) % 1000000007;
        if (f < 0)
          a[j + k] = x,
                a[i + j + k] = ((y - x) % 1000000007 + 1000000007) % 1000000007;
      }
}
void fwt_and(long long *a, int f) {
  for (int i = 1; i < m; i <<= 1)
    for (int j = 0; j < m; j += (i << 1))
      for (int k = 0; k < i; k++) {
        long long x = a[j + k], y = a[i + j + k];
        if (f > 0) a[j + k] = (x + y) % 1000000007, a[i + j + k] = y;
        if (f < 0)
          a[j + k] = ((x - y) % 1000000007 + 1000000007) % 1000000007,
                a[i + j + k] = y;
      }
}
int main() {
  fib[1] = 1;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &s[i]), maxx = max(maxx, s[i]);
  for (m = 1; m <= maxx; m <<= 1)
    ;
  for (int i = 1; i < m; i++) cnt[i] = cnt[i >> 1] + (i & 1);
  for (int i = 2; i < m; i++) fib[i] = (fib[i - 1] + fib[i - 2]) % 1000000007;
  for (int i = 1; i <= n; i++)
    a[cnt[s[i]]][s[i]]++, b[cnt[s[i]]][s[i]]++, c[s[i]]++, d[s[i]]++, e[s[i]]++;
  for (int i = 0; i < m; i++) c[i] = c[i] * fib[i] % 1000000007;
  fwt_xor(d, 1);
  fwt_xor(e, 1);
  for (int i = 0; i < m; i++) d[i] = d[i] * e[i] % 1000000007;
  fwt_xor(d, -1);
  for (int i = 0; i < m; i++) d[i] = d[i] * fib[i] % 1000000007;
  for (int k = 0; k <= cnt[m - 1]; k++) fwt_or(a[k], 1), fwt_or(b[k], 1);
  for (int i = 0; i <= cnt[m - 1]; i++)
    for (int j = 0; j <= cnt[m - 1]; j++)
      for (int k = 0; k < m; k++)
        if (i + j <= cnt[m - 1])
          f[i + j][k] = (f[i + j][k] + a[i][k] * b[j][k]) % 1000000007;
  for (int i = 0; i <= cnt[m - 1]; i++) fwt_or(f[i], -1);
  for (int i = 0; i < m; i++) e[i] = f[cnt[i]][i] * fib[i] % 1000000007;
  fwt_and(c, 1);
  fwt_and(d, 1);
  fwt_and(e, 1);
  for (int i = 0; i < m; i++)
    c[i] = c[i] * d[i] % 1000000007 * e[i] % 1000000007;
  fwt_and(c, -1);
  for (int i = 1; i < m; i <<= 1) ans = (ans + c[i]) % 1000000007;
  printf("%I64d\n", ans);
  return 0;
}
