#include <bits/stdc++.h>
using namespace std;
inline long long read() {
  long long x = 0;
  bool f = 1;
  char s = getchar();
  while ((s < '0' || s > '9') && s > 0) {
    if (s == '-') f ^= 1;
    s = getchar();
  }
  while (s >= '0' && s <= '9') x = (x << 1) + (x << 3) + s - '0', s = getchar();
  return f ? x : -x;
}
inline long long ksm(long long a, long long b, long long mo) {
  long long res = 1;
  for (; b; b >>= 1, a = a * a % mo)
    if (b & 1) res = res * a % mo;
  return res;
}
const long long inv2 = ksm(2, 1000000007ll - 2, 1000000007ll);
inline void FWTOR(int* a, int n, int inv) {
  for (int k = 2; k <= n; k <<= 1)
    for (int i = 0; i < n; i += k)
      for (int j = i; j < i + (k >> 1); j++)
        a[j + (k >> 1)] =
            (1000000007ll + a[j + (k >> 1)] + a[j] * inv) % 1000000007ll;
}
inline void FWTAND(int* a, int n, int inv) {
  for (int k = 2; k <= n; k <<= 1)
    for (int i = 0; i < n; i += k)
      for (int j = i; j < i + (k >> 1); j++)
        a[j] = (1000000007ll + a[j] + a[j + (k >> 1)] * inv) % 1000000007ll;
}
inline void FWTXOR(int* a, int n, int inv) {
  long long in2 = inv > 0 ? 1 : inv2, a0, a1;
  for (int k = 2; k <= n; k <<= 1)
    for (int i = 0; i < n; i += k)
      for (int j = i; j < i + (k >> 1); j++)
        a0 = a[j], a1 = a[j + (k >> 1)],
        a[j] = (a0 + a1) % 1000000007ll * in2 % 1000000007ll,
        a[j + (k >> 1)] =
            (a0 - a1 + 1000000007ll) % 1000000007ll * in2 % 1000000007ll;
}
int n, nm[131080], fi[131080], s[1000005], ac[20][131080], ca[20][131080],
    cb[131080];
int a[131080], b[131080], c[131080], ans, bt;
signed main() {
  n = read();
  for (int i = 1; i < (1 << 17); i++) nm[i] = nm[i >> 1] + (i & 1);
  for (int i = 1; i <= n; i++) s[i] = read(), ca[nm[s[i]]][s[i]]++, cb[s[i]]++;
  for (int i = 1; i <= n; i++)
    while ((1 << bt) <= s[i]) bt++;
  fi[1] = 1;
  for (int i = 2; i < (1 << bt); i++)
    fi[i] = (0ll + fi[i - 1] + fi[i - 2]) % 1000000007ll;
  for (int i = 0; i < (1 << bt); i++) c[i] = 1ll * cb[i] * fi[i] % 1000000007ll;
  FWTXOR(cb, 1 << bt, 1);
  for (int i = 0; i < (1 << bt); i++)
    cb[i] = 1ll * cb[i] * cb[i] % 1000000007ll;
  FWTXOR(cb, 1 << bt, -1);
  for (int i = 0; i <= bt; i++) {
    FWTOR(ca[i], 1 << bt, 1);
    for (int k = 0; k < (1 << bt); k++) {
      ac[i][k] = 0;
      for (int j = 0; j <= i; j++)
        ac[i][k] = (1ll * ca[j][k] * ca[i - j][k] + ac[i][k]) % 1000000007ll;
    }
    FWTOR(ac[i], 1 << bt, -1);
  }
  for (int i = 0; i < (1 << bt); i++) ac[0][i] = ac[nm[i]][i];
  for (int i = 0; i < (1 << bt); i++)
    a[i] = 1ll * ac[0][i] * fi[i] % 1000000007ll,
    b[i] = 1ll * cb[i] * fi[i] % 1000000007ll;
  FWTAND(a, 1 << bt, 1), FWTAND(b, 1 << bt, 1), FWTAND(c, 1 << bt, 1);
  for (int i = 0; i < (1 << bt); i++)
    a[i] = 1ll * a[i] * b[i] % 1000000007ll * c[i] % 1000000007ll;
  FWTAND(a, 1 << bt, -1);
  for (int i = 0; i < bt; i++) ans = (0ll + ans + a[1 << i]) % 1000000007ll;
  printf("%d\n", ans);
  return 0;
}
