#include <bits/stdc++.h>
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
const int B = 17;
const int N = 1 << B;
const long long int M = (int)1e9 + 7;
const long long int inv2 = (int)5e8 + 4;
int n;
long long int cnt[N], fib[N], ab[N], Xor[N], And[N];
void transform_xor(long long int x[], bool inv = 0) {
  for (int mid = 1, i = 2; i <= N; mid = i, i <<= 1)
    for (int j = 0, lo = 0; lo < N; j + 1 == mid ? (lo += i, j = 0) : ++j) {
      long long int tw1 = x[lo + j], tw2 = x[lo + j + mid];
      if (inv) {
        x[lo + j] = (tw1 + tw2) % M * inv2 % M;
        x[lo + j + mid] = (tw1 - tw2 + M) % M * inv2 % M;
      } else {
        x[lo + j] = tw1 + tw2;
        if (x[lo + j] >= M) x[lo + j] -= M;
        x[lo + j + mid] = tw1 - tw2;
        if (x[lo + j + mid] < 0) x[lo + j + mid] += M;
      }
    }
}
void transform_and(long long int p[], bool inv = 0) {
  for (int len = 1; (len << 1) <= N; len <<= 1)
    for (int i = 0; i < N; i += (len << 1))
      for (int j = 0; j < len; ++j) {
        long long int tw1 = p[i + j];
        long long int tw2 = p[i + len + j];
        if (!inv) {
          p[i + j] = tw2;
          p[i + len + j] = tw1 + tw2;
          if (p[i + len + j] >= M) p[i + len + j] -= M;
        } else {
          p[i + j] = tw2 - tw1;
          if (p[i + j] < 0) p[i + j] += M;
          p[i + len + j] = tw1;
        }
      }
}
void solve(std::istream &in, std::ostream &out) {
  fib[0] = 0, fib[1] = 1;
  for (int i = 2; i < N; ++i) {
    fib[i] = fib[i - 1] + fib[i - 2];
    if (fib[i] >= M) fib[i] -= M;
  }
  in >> n;
  for (int i = 1; i <= n; ++i) {
    int x;
    in >> x;
    ++cnt[x];
  }
  for (int i = 0; i < N; ++i) {
    ab[i] = 0;
    for (int j = (i - 1) & i; j > 0; j = (j - 1) & i) {
      ab[i] += cnt[j] * cnt[j ^ i] % M;
      if (ab[i] >= M) ab[i] -= M;
    }
    if (cnt[0] && cnt[i]) {
      ab[i] += cnt[0] * cnt[i] * 2 % M;
      if (ab[i] >= M) ab[i] -= M;
    }
  }
  memcpy(Xor, cnt, sizeof cnt);
  transform_xor(Xor);
  for (int i = 0; i < N; ++i) Xor[i] = Xor[i] * Xor[i] % M;
  transform_xor(Xor, 1);
  for (int i = 0; i < N; ++i)
    Xor[i] = Xor[i] * fib[i] % M, ab[i] = ab[i] * fib[i] % M,
    cnt[i] = cnt[i] * fib[i] % M;
  transform_and(Xor);
  transform_and(ab);
  transform_and(cnt);
  for (int i = 0; i < N; ++i) And[i] = Xor[i] * ab[i] % M * cnt[i] % M;
  transform_and(And, 1);
  long long int ans = 0;
  for (int i = 1; i < N; i <<= 1) ans = (ans + And[i]) % M;
  out << ans << '\n';
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0), cout.tie(0);
  solve(cin, cout);
  return 0;
}
