#include <bits/stdc++.h>
const int N = 1 << 18, mu = 1e9 + 7, inv2 = (mu + 1) >> 1;
int a[N], p[N], f[N], b[N], c[N], t[18][N], l, limit = 1, mx, n, s[1000005],
                                               cnt[18][N];
void reduce(int &x) { x += x >> 31 & mu; }
void fwt_or(int *a, int opt) {
  for (int mid = 1; mid < limit; mid <<= 1)
    for (int r = mid << 1, i = 0; i < limit; i += r)
      for (int j = 0; j < mid; j++)
        if (opt == 1)
          reduce(a[i + j + mid] += a[i + j] - mu);
        else
          reduce(a[i + j + mid] -= a[i + j]);
}
void fwt_xor(int *a, int opt) {
  for (int mid = 1; mid < limit; mid <<= 1)
    for (int r = mid << 1, i = 0; i < limit; i += r)
      for (int j = 0; j < mid; j++) {
        int x = a[i + j], y = a[i + j + mid];
        reduce(a[i + j] = x + y - mu);
        reduce(a[i + j + mid] = x - y);
        if (opt == -1)
          a[i + j] = a[i + j] * 1ll * inv2 % mu,
                a[i + j + mid] = a[i + j + mid] * 1ll * inv2 % mu;
      }
}
void fwt_and(int *a, int opt) {
  for (int mid = 1; mid < limit; mid <<= 1)
    for (int r = mid << 1, i = 0; i < limit; i += r)
      for (int j = 0; j < mid; j++)
        if (opt == 1)
          reduce(a[i + j] += a[i + j + mid] - mu);
        else
          reduce(a[i + j] -= a[i + j + mid]);
}
void init() {
  limit = 1;
  while (limit <= mx) limit <<= 1, l++;
  for (int i = 2; i <= limit; i++) p[i] = p[i >> 1] + (i & 1);
  f[0] = 0, f[1] = 1;
  for (int i = 2; i <= limit; i++) reduce(f[i] = f[i - 1] + f[i - 2] - mu);
  for (int i = 1; i <= n; i++) {
    cnt[p[s[i]]][s[i]]++;
    reduce(b[s[i]] += f[s[i]] - mu);
    c[s[i]]++;
  }
}
void fst() {
  for (int i = 0; i <= l; i++) fwt_or(cnt[i], 1);
  for (int i = 0; i <= l; i++) {
    for (int j = 0; j <= i; j++)
      for (int S = 0; S < limit; S++)
        t[i][S] = (t[i][S] + cnt[j][S] * 1ll * cnt[i - j][S]) % mu;
    fwt_or(t[i], -1);
  }
  for (int i = 0; i < limit; i++) a[i] = t[p[i]][i] * 1ll * f[i] % mu;
}
int main() {
  scanf("%d", &n);
  p[1] = 1;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &s[i]);
    mx = std::max(mx, s[i]);
  }
  init();
  fst();
  fwt_xor(c, 1);
  for (int i = 0; i < limit; i++) c[i] = c[i] * 1ll * c[i] % mu;
  fwt_xor(c, -1);
  for (int i = 0; i < limit; i++) c[i] = c[i] * 1ll * f[i] % mu;
  fwt_and(a, 1), fwt_and(b, 1), fwt_and(c, 1);
  for (int i = 0; i < limit; i++) a[i] = 1ll * a[i] * b[i] % mu * c[i] % mu;
  fwt_and(a, -1);
  int ans = 0;
  for (int i = 1; i < limit; i <<= 1) reduce(ans += a[i] - mu);
  printf("%d\n", ans);
}
