#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline void read(T &x) {
  x = 0;
  T k = 1;
  char c = getchar();
  while (!isdigit(c)) {
    if (c == '-') k = -1;
    c = getchar();
  }
  while (isdigit(c)) {
    x = x * 10 + c - '0';
    c = getchar();
  }
  x *= k;
}
const int len = 1 << 17;
const int N = len | 7;
const int p = 1e9 + 7;
const int Inv2 = (p + 1) >> 1;
inline int add(int a, int b) {
  a += b;
  if (a >= p) a -= p;
  return a;
}
inline int sub(int a, int b) {
  a -= b;
  if (a < 0) a += p;
  return a;
}
inline void FWT_or(int *A, bool opt = 1) {
  for (int i = 1; i < len; i <<= 1) {
    for (int j = 0; j < len; j += i << 1) {
      for (int k = 0; k < i; ++k) {
        A[j + k + i] =
            opt ? add(A[j + k], A[j + k + i]) : sub(A[j + k + i], A[j + k]);
      }
    }
  }
}
inline void FWT_and(int *A, bool opt = 1) {
  for (int i = 1; i < len; i <<= 1) {
    for (int j = 0; j < len; j += i << 1) {
      for (int k = 0; k < i; ++k) {
        A[j + k] =
            opt ? add(A[j + k], A[j + k + i]) : sub(A[j + k], A[j + k + i]);
      }
    }
  }
}
inline void FWT_xor(int *A, bool opt = 1) {
  for (int i = 1; i < len; i <<= 1) {
    for (int j = 0; j < len; j += i << 1) {
      for (int k = 0; k < i; ++k) {
        int u = A[j + k], v = A[j + k + i];
        A[j + k] = add(u, v);
        A[j + k + i] = sub(u, v);
        if (!opt) {
          A[j + k] = (long long)A[j + k] * Inv2 % p;
          A[j + k + i] = (long long)A[j + k + i] * Inv2 % p;
        }
      }
    }
  }
}
int cnt[N], A[N], B[N], C[N], F[N], fib[N], bit[N];
int t[20][N], f[20][N];
int main() {
  int n;
  read(n);
  for (int i = 1, x; i <= n; ++i) {
    read(x), ++cnt[x];
  }
  for (int i = 0; i < len; ++i) {
    t[bit[i] = (bit[i >> 1] + (i & 1))][i] = cnt[i];
  }
  for (int i = 0; i <= 17; ++i) {
    FWT_or(t[i]);
  }
  for (int i = 0; i <= 17; ++i) {
    for (int j = 0; i + j <= 17; ++j) {
      for (int k = 0; k < len; ++k) {
        f[i + j][k] = add(f[i + j][k], (long long)t[i][k] * t[j][k] % p);
      }
    }
  }
  for (int i = 0; i <= 17; ++i) FWT_or(f[i], 0);
  for (int i = 0; i < len; ++i) {
    A[i] = f[bit[i]][i];
  }
  for (int i = 0; i < len; ++i) {
    B[i] = cnt[i];
  }
  FWT_xor(cnt);
  for (int i = 0; i < len; ++i) {
    C[i] = (long long)cnt[i] * cnt[i] % p;
  }
  FWT_xor(C, 0);
  fib[1] = 1;
  for (int i = 2; i < len; ++i) {
    fib[i] = add(fib[i - 1], fib[i - 2]);
  }
  for (int i = 0; i < len; ++i) {
    A[i] = (long long)A[i] * fib[i] % p;
    B[i] = (long long)B[i] * fib[i] % p;
    C[i] = (long long)C[i] * fib[i] % p;
  }
  FWT_and(A);
  FWT_and(B);
  FWT_and(C);
  for (int i = 0; i < len; ++i) {
    F[i] = (long long)A[i] * B[i] % p * C[i] % p;
  }
  FWT_and(F, 0);
  int ans = 0;
  for (int i = 1; i < len; i <<= 1) {
    ans = add(ans, F[i]);
  }
  printf("%d\n", ans);
}
