#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7, sizeinv = 742744451, lg = 17, N = 1 << lg;
vector<long long> fast_OR_transform(vector<long long> f, bool inverse = false) {
  for (int i = 0; (1 << i) < f.size(); ++i)
    for (int j = 0; j < f.size(); j += 2 << i)
      for (int k = 0; k < (1 << i); ++k)
        (f[j + k + (1 << i)] += f[j + k] * (inverse ? -1 : 1)) %= mod;
  return f;
}
vector<long long> rev(vector<long long> A) {
  for (int i = 0; i < A.size(); i += 2) swap(A[i], A[i ^ (A.size() - 1)]);
  return A;
}
vector<long long> fast_AND_transform(vector<long long> f,
                                     bool inverse = false) {
  return rev(fast_OR_transform(rev(f), inverse));
}
vector<long long> fast_XOR_transform(vector<long long> f,
                                     bool inverse = false) {
  for (int i = 0; (1 << i) < f.size(); ++i)
    for (int j = 0; j < f.size(); j += 2 << i)
      for (int k = 0; k < (1 << i); ++k) {
        long long u = f[j + k], v = f[j + k + (1 << i)];
        f[j + k + (1 << i)] = (u - v + mod) % mod, f[j + k] = (u + v) % mod;
      }
  if (inverse)
    for (auto &a : f) a = a * sizeinv % mod;
  return f;
}
vector<long long> dot(vector<long long> A, vector<long long> B) {
  for (int i = 0; i < A.size(); ++i) A[i] = A[i] * B[i] % mod;
  return A;
}
long long fibo[N] = {0, 1};
int main() {
  int m, a;
  scanf("%d", &m);
  for (int i = 2; i < N; ++i) fibo[i] = (fibo[i - 1] + fibo[i - 2]) % mod;
  vector<long long> cnt(N, 0), A(N, 0), B(N, 0), C(N, 0);
  vector<long long> div[lg + 1], sum[lg + 1];
  for (int i = 0; i <= lg; ++i) div[i].assign(N, 0), sum[i].assign(N, 0);
  while (m--) scanf("%d", &a), ++cnt[a], ++div[__builtin_popcount(a)][a];
  for (auto &V : div) V = fast_OR_transform(V);
  for (int i = 0; i <= lg; ++i) {
    for (int j = 0; j <= i; ++j)
      for (int k = 0; k < N; ++k)
        (sum[i][k] += (div[j][k] * div[i - j][k])) %= mod;
    sum[i] = fast_OR_transform(sum[i], 1);
  }
  for (int i = 0; i < N; ++i) A[i] = sum[__builtin_popcount(i)][i];
  B = cnt;
  C = fast_XOR_transform(cnt), C = fast_XOR_transform(dot(C, C), 1);
  for (int i = 0; i < N; ++i) {
    A[i] = fibo[i] * A[i] % mod;
    B[i] = fibo[i] * B[i] % mod;
    C[i] = fibo[i] * C[i] % mod;
  }
  A = dot(fast_AND_transform(A),
          dot(fast_AND_transform(B), fast_AND_transform(C)));
  A = fast_AND_transform(A, 1);
  long long ans = 0;
  for (int i = 0; i < lg; ++i) ans = ans + A[1 << i], ans %= mod;
  printf("%lld\n", (ans + mod) % mod);
}
