#include <bits/stdc++.h>
using namespace std;
int n, f[1000006], s[1000006], OR[1000006], SUB[1000006], XOR[1000006],
    AND[1000006], amount[1000006];
int p[18][1000006], q[18][1000006], l[18][1000006];
const int mod = 1e9 + 7, D = 17;
int power(long long a, int b) {
  long long res = 1;
  while (b) {
    if (b & 1) res = res * a % mod;
    a = a * a % mod;
    b >>= 1;
  }
  return res % mod;
}
int inv2 = power(2, mod - 2);
int read() {
  char c = getchar();
  int x = 0;
  while (!isdigit(c)) c = getchar();
  while (isdigit(c)) {
    x = (x << 3) + (x << 1) + c - '0';
    c = getchar();
  }
  return x;
}
void build() {
  f[1] = 1;
  int limit = (1 << D) - 1;
  for (int i = 2; i <= limit; ++i) f[i] = (f[i - 1] + f[i - 2]) % mod;
  for (int i = 1; i <= limit; ++i) amount[i] = amount[i >> 1] + (i & 1);
}
int init(int n) {
  int limit = 1;
  while (limit <= n) limit <<= 1;
  return limit;
}
void FWTAND(int* a, int n, int opt) {
  for (int i = 1; i < n; i <<= 1)
    for (int j = 0; j < n; j += (i << 1))
      for (int k = 0; k < i; ++k) {
        int x = a[j + k], y = a[j + k + i];
        if (opt == 1)
          a[j + k] = (x + y) % mod;
        else
          a[j + k] = (x - y) % mod;
      }
}
void FWTOR(int* a, int n, int opt) {
  for (int i = 1; i < n; i <<= 1)
    for (int j = 0; j < n; j += (i << 1))
      for (int k = 0; k < i; ++k) {
        int x = a[j + k], y = a[j + k + i];
        if (opt == 1)
          a[j + k + i] = (x + y) % mod;
        else
          a[j + k + i] = (y - x + mod) % mod;
      }
}
void FWTXOR(int* a, int n, int opt) {
  for (int i = 1; i < n; i <<= 1)
    for (int j = 0; j < n; j += (i << 1))
      for (int k = 0; k < i; ++k) {
        int x = a[j + k], y = a[j + k + i];
        if (opt == 1) {
          a[j + k] = (x + y) % mod;
          a[j + k + i] = (x - y + mod) % mod;
        } else {
          a[j + k] = 1ll * (x + y) * inv2 % mod;
          a[j + k + i] = 1ll * (x - y + mod) * inv2 % mod;
        }
      }
}
void FST(int* a, int n, int opt) {
  for (int i = 0; i < D; ++i)
    for (int j = 0; j < n; ++j)
      if (j >> i & 1) {
        if (opt == 1)
          a[j] = (a[j] + a[j ^ (1 << i)]) % mod;
        else
          a[j] = (a[j] - a[j ^ (1 << i)] + mod) % mod;
      }
}
int main() {
  n = read();
  build();
  int maxi = 0;
  for (int i = 1; i <= n; ++i) {
    s[i] = read();
    maxi = max(maxi, s[i]);
    ++OR[s[i]];
    ++XOR[s[i]];
    ++AND[s[i]];
  }
  int m = init(maxi);
  for (int i = 0; i < m; ++i) p[amount[i]][i] = OR[i];
  for (int i = 0; i < D; ++i) FST(p[i], m, 1);
  for (int i = 0; i <= D; ++i)
    for (int j = 0; j <= i; ++j)
      for (int s = 0; s < m; ++s)
        q[i][s] = (1ll * p[i - j][s] * p[j][s] % mod + q[i][s]) % mod;
  for (int i = 0; i <= D; ++i) FST(q[i], m, -1);
  for (int i = 0; i < m; ++i) OR[i] = q[amount[i]][i];
  FWTXOR(XOR, m, 1);
  for (int i = 0; i < m; ++i) XOR[i] = 1ll * XOR[i] * XOR[i] % mod;
  FWTXOR(XOR, m, -1);
  for (int i = 1; i <= m; ++i) OR[i] = 1ll * f[i] * OR[i] % mod;
  for (int i = 1; i <= m; ++i) XOR[i] = 1ll * f[i] * XOR[i] % mod;
  for (int i = 1; i <= m; ++i) AND[i] = 1ll * f[i] * AND[i] % mod;
  FWTAND(AND, m, 1);
  FWTAND(OR, m, 1);
  FWTAND(XOR, m, 1);
  for (int i = 0; i < m; ++i)
    AND[i] = 1ll * AND[i] * XOR[i] % mod * OR[i] % mod;
  FWTAND(AND, m, -1);
  int ans = 0;
  for (int i = 0; i < D; ++i) ans = (ans + AND[(1 << i)]) % mod;
  printf("%d\n", (ans + mod) % mod);
}
