#include <bits/stdc++.h>
using namespace std;
const int sz = 17;
const int dim = 1 << sz;
int n, i, j, k;
int s[1000011];
long long fib[1000011];
long long aux[1000011];
long long aux2[1000011];
long long p1[1000011];
long long p2[1000011];
long long p3[1000011];
long long sol[1000011];
long long conv_a[sz + 1][dim], conv_b[sz + 1][dim];
long long bts_cnt(long long x) {
  long long ans = 0;
  while (x > 0) {
    if (x & 1) ans++;
    x >>= 1;
  }
  return ans;
}
long long poww(long long a, long long b) {
  long long ans = 1;
  while (b > 0) {
    if (b & 1) ans = (ans * a) % 1000000007;
    b >>= 1;
    a = (a * a) % 1000000007;
  }
  return ans;
}
void fwht(long long *data, bool inv = false) {
  long long n, i, j, len, u, v;
  n = dim;
  for (len = 1; 2 * len <= n; len <<= 1) {
    for (i = 0; i < n; i += 2 * len) {
      for (j = 0; j < len; j++) {
        u = data[i + j];
        v = data[i + len + j];
        data[i + j] = u + v;
        data[i + len + j] = u + 1000000007 - v;
        data[i + j] %= 1000000007;
        data[i + len + j] %= 1000000007;
      }
    }
  }
  if (inv) {
    long long xx = poww(n, 1000000007 - 2);
    for (i = 0; i < n; i++) data[i] = (data[i] * xx) % 1000000007;
  }
}
void dp_subset(long long *data, long long sgn) {
  int i, j;
  for (i = 0; i < sz; i++) {
    for (j = 0; j < dim; j++) {
      if (j & (1 << i)) {
        data[j] += 1000000007 + sgn * data[j ^ (1 << i)];
        data[j] %= 1000000007;
      }
    }
  }
}
void dp_supraset(long long *data, long long sgn) {
  int i, j;
  for (i = 0; i < sz; i++) {
    for (j = 0; j < dim; j++) {
      if ((j & (1 << i)) == 0) {
        data[j] += 1000000007 + sgn * data[j ^ (1 << i)];
        data[j] %= 1000000007;
      }
    }
  }
}
int main() {
  fib[0] = 0;
  fib[1] = 1;
  for (i = 2; i <= dim; i++) fib[i] = (fib[i - 1] + fib[i - 2]) % 1000000007;
  scanf("%d", &n);
  for (i = 1; i <= n; i++) scanf("%d", &s[i]);
  for (i = 1; i <= n; i++) conv_a[bts_cnt(s[i])][s[i]]++;
  for (i = 0; i <= sz; i++) dp_subset(conv_a[i], +1);
  for (i = 0; i < dim; i++) {
    for (j = 0; j <= sz; j++) {
      long long work = 0;
      for (k = 0; k <= j; k++) {
        work += conv_a[k][i] * conv_a[j - k][i];
        work %= 1000000007;
      }
      conv_b[j][i] = work;
    }
  }
  for (i = 0; i <= sz; i++) dp_subset(conv_b[i], -1);
  for (i = 0; i < dim; i++) p1[i] = conv_b[bts_cnt(i)][i];
  for (i = 1; i <= n; i++) p2[s[i]]++;
  memset(aux, 0, sizeof(aux));
  for (i = 1; i <= n; i++) aux[s[i]]++;
  fwht(aux);
  for (i = 0; i < dim; i++) aux[i] = (aux[i] * aux[i]) % 1000000007;
  fwht(aux, true);
  for (i = 0; i < dim; i++) p3[i] = aux[i];
  for (i = 0; i < dim; i++) {
    p1[i] = (p1[i] * fib[i]) % 1000000007;
    p2[i] = (p2[i] * fib[i]) % 1000000007;
    p3[i] = (p3[i] * fib[i]) % 1000000007;
  }
  dp_supraset(p1, +1);
  dp_supraset(p2, +1);
  dp_supraset(p3, +1);
  for (i = 0; i < dim; i++) {
    sol[i] = p1[i] * p2[i];
    sol[i] %= 1000000007;
    sol[i] *= p3[i];
    sol[i] %= 1000000007;
  }
  dp_supraset(sol, -1);
  long long ans = 0;
  for (i = 0; i < sz; i++) ans += sol[1 << i];
  ans %= 1000000007;
  printf("%lld", ans);
  return 0;
}
