#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const long long INFF = 0x3f3f3f3f3f3f3f3fll;
const long long M = 1e9 + 7;
const long long maxn = 1e6 + 7;
const double eps = 0.00000001;
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
template <typename T>
inline T abs(T a) {
  return a > 0 ? a : -a;
}
template <typename T>
inline T powMM(T a, T b) {
  T ret = 1;
  for (; b; b >>= 1ll, a = 1ll * a * a % M)
    if (b & 1) ret = 1ll * ret * a % M;
  return ret;
}
void fwt(long long *A, int len, int inv, int type) {
  int i, j, k;
  int div = powMM(2ll, M - 2);
  for (i = 2; i <= len; i <<= 1) {
    for (j = 0; j < len; j += i) {
      for (k = j; k < j + i / 2; k++) {
        if (inv == 1) {
          long long a = A[k], b = A[k + i / 2];
          if (type == 1) {
            A[k] = (a + b) % M;
            A[k + i / 2] = (a - b + M) % M;
          } else if (type == 2) {
            A[k] = (a + b) % M;
          } else if (type == 3) {
            A[k + i / 2] = (a + b) % M;
          }
        } else {
          long long a = A[k], b = A[k + i / 2];
          if (type == 1) {
            A[k] = (a + b) * div % M;
            A[k + i / 2] = (a - b + M) % M * div % M;
          } else if (type == 2) {
            A[k] = (a - b + M) % M;
          } else if (type == 3) {
            A[k + i / 2] = (b - a + M) % M;
          }
        }
      }
    }
  }
}
int k;
int n;
long long f[maxn];
long long A[maxn], B[maxn], C[maxn];
int g[maxn];
int main() {
  int i, j;
  scanf("%d", &n);
  for (i = 1; i <= n; i++) scanf("%d", &k), f[k]++;
  for (i = 0; i < (1 << 17); i++)
    for (j = i;; j = (j - 1) & i) {
      (A[i] += f[j] * f[i ^ j]) %= M;
      if (!j) break;
    }
  for (i = 0; i < (1 << 17); i++) B[i] = f[i];
  for (i = 0; i < (1 << 17); i++) C[i] = f[i];
  fwt(C, 1 << 17, 1, 1);
  for (i = 0; i < (1 << 17); i++) C[i] = (C[i] * C[i]) % M;
  fwt(C, 1 << 17, -1, 1);
  f[0] = 0;
  f[1] = 1;
  for (i = 2; i <= (1 << 17); i++) f[i] = (f[i - 1] + f[i - 2]) % M;
  for (i = 0; i < (1 << 17); i++) {
    (A[i] *= f[i]) %= M;
    (B[i] *= f[i]) %= M;
    (C[i] *= f[i]) %= M;
  }
  fwt(A, 1 << 17, 1, 2);
  fwt(B, 1 << 17, 1, 2);
  fwt(C, 1 << 17, 1, 2);
  for (i = 0; i < (1 << 17); i++) (A[i] *= B[i]) %= M, (A[i] *= C[i]) %= M;
  fwt(A, 1 << 17, -1, 2);
  int ANS = 0;
  for (i = 0; i < 17; i++) (ANS += A[1 << i]) %= M;
  printf("%d\n", ANS);
}
