#include <bits/stdc++.h>
using namespace std;
long long read() {
  long long f = 1, x = 0;
  char s = getchar();
  while (s < '0' || s > '9') {
    if (s == '-') f = -f;
    s = getchar();
  }
  while (s >= '0' && s <= '9') {
    x = x * 10 + (s - '0');
    s = getchar();
  }
  return f * x;
}
char readchar() {
  char s = getchar();
  while (s == ' ' || s == '\n') s = getchar();
  return s;
}
const int MOD = 1000000007;
const int inv2 = 1000000008 / 2;
int n, m, i, j, s, o, k;
int qm(int a, int M) { return (a > M ? a - M : a); }
void DWTOR(int *s, int n) {
  for (int k = 1; k < n; k <<= 1) {
    for (int j = 0; j < n; j += (k << 1)) {
      for (int i = j; i < j + k; i++) {
        (s[i + k] += s[i]) %= MOD;
      }
    }
  }
  return;
}
void IDWTOR(int *s, int n) {
  for (int k = n / 2; k > 0; k >>= 1) {
    for (int j = 0; j < n; j += (k << 1)) {
      for (int i = j; i < j + k; i++) {
        (s[i + k] += MOD - s[i]) %= MOD;
      }
    }
  }
  return;
}
void DWTAND(int *s, int n) {
  for (int k = 1; k < n; k <<= 1) {
    for (int j = 0; j < n; j += (k << 1)) {
      for (int i = j; i < j + k; i++) {
        (s[i] += s[i + k]) %= MOD;
      }
    }
  }
  return;
}
void IDWTAND(int *s, int n) {
  for (int k = n / 2; k > 0; k >>= 1) {
    for (int j = 0; j < n; j += (k << 1)) {
      for (int i = j; i < j + k; i++) {
        (s[i] += MOD - s[i + k]) %= MOD;
      }
    }
  }
  return;
}
void DWTXOR(int *s, int n) {
  for (int k = 1; k < n; k <<= 1) {
    for (int j = 0; j < n; j += (k << 1)) {
      for (int i = j; i < j + k; i++) {
        int A = s[i], B = s[i + k];
        s[i] = qm((A + B), MOD);
        s[i + k] = qm((A + MOD - B), MOD);
      }
    }
  }
  return;
}
void IDWTXOR(int *s, int n) {
  for (int k = n / 2; k > 0; k >>= 1) {
    for (int j = 0; j < n; j += (k << 1)) {
      for (int i = j; i < j + k; i++) {
        int A = s[i], B = s[i + k];
        s[i] = qm((A + B), MOD) * 1ll * inv2 % MOD;
        s[i + k] = qm((A + MOD - B), MOD) * 1ll * inv2 % MOD;
      }
    }
  }
  return;
}
void putbit(int x, int bt) {
  if (bt == 0) return;
  putbit(x >> 1, bt - 1);
  putchar((x & 1) + '0');
}
int ct[(1 << 17 | 5)], po[(1 << 17 | 5)];
int A[21][(1 << 17 | 5)], B[21][(1 << 17 | 5)];
int aa[(1 << 17 | 5)], bb[(1 << 17 | 5)], cc[(1 << 17 | 5)];
int fi[(1 << 17 | 5)];
int main() {
  int le = read(), mn = 0;
  for (int i = 1; i < (1 << 17); i++) ct[i] = ct[i - (-(i) & (i))] + 1;
  for (int i = 1; i <= le; i++) {
    s = read();
    mn = max(mn, s);
    B[ct[s]][s]++;
    bb[s]++;
    cc[s]++;
  }
  n = 0, m = 1;
  while (m <= mn) m <<= 1, n++;
  for (int i = 0; i <= n; i++) DWTOR(B[i], m);
  DWTXOR(bb, m);
  for (int i = 0; i < m; i++) bb[i] = bb[i] * 1ll * bb[i] % MOD;
  IDWTXOR(bb, m);
  for (int i = 0; i <= n; i++) {
    for (int j = 0; j <= i; j++) {
      for (int k = 0; k < m; k++) {
        (A[i][k] += B[j][k] * 1ll * B[i - j][k] % MOD) %= MOD;
      }
    }
    IDWTOR(A[i], m);
  }
  fi[0] = 0;
  fi[1] = 1;
  for (int i = 2; i < m; i++) fi[i] = (fi[i - 1] + fi[i - 2]) % MOD;
  for (int i = 0; i < m; i++) {
    aa[i] = A[ct[i]][i] * 1ll * fi[i] % MOD;
    bb[i] = bb[i] * 1ll * fi[i] % MOD;
    cc[i] = cc[i] * 1ll * fi[i] % MOD;
  }
  DWTAND(aa, m);
  DWTAND(bb, m);
  DWTAND(cc, m);
  for (int i = 0; i < m; i++) {
    aa[i] = aa[i] * 1ll * bb[i] % MOD * 1ll * cc[i] % MOD;
  }
  IDWTAND(aa, m);
  int ans = 0;
  for (int i = 1; i < m; i <<= 1) {
    (ans += aa[i]) %= MOD;
  }
  printf("%d\n", ans);
  return 0;
}
