Problem: You are given an array s of n non-negative integers.

A 5-tuple of integers (a, b, c, d, e) is said to be valid if it satisfies the following conditions: 

  * 1 ≤ a, b, c, d, e ≤ n
  * (sa | sb) & sc & (sd ^ se) = 2i for some integer i
  * sa & sb = 0



Here, '|' is the bitwise OR, '&' is the bitwise AND and '^' is the bitwise XOR operation.

Find the sum of f(sa|sb) * f(sc) * f(sd^se) over all valid 5-tuples (a, b, c, d, e), where f(i) is the i-th Fibonnaci number (f(0) = 0, f(1) = 1, f(i) = f(i - 1) + f(i - 2)).

Since answer can be is huge output it modulo 109 + 7.

Input

The first line of input contains an integer n (1 ≤ n ≤ 106).

The second line of input contains n integers si (0 ≤ si < 217).

Output

Output the sum as described above, modulo 109 + 7

Examples

Input

2
1 2


Output

32


Input

3
7 4 1


Output

3520


Input

10
1 3 0 7 3 7 6 5 7 5


Output

1235424


Input

10
50 9 11 44 39 40 5 39 23 7


Output

113860062

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
template <typename T>
void read(T &x) {
  x = 0;
  bool f = 0;
  char c = getchar();
  for (; !isdigit(c); c = getchar())
    if (c == '-') f = 1;
  for (; isdigit(c); c = getchar()) x = x * 10 + (c ^ 48);
  if (f) x = -x;
}
template <typename F>
inline void write(F x) {
  static short st[30];
  short tp = 0;
  if (x < 0) putchar('-'), x = -x;
  do st[++tp] = x % 10, x /= 10;
  while (x);
  while (tp) putchar('0' | st[tp--]);
  putchar('\n');
}
template <typename T>
inline void Mx(T &x, T y) {
  x < y && (x = y);
}
template <typename T>
inline void Mn(T &x, T y) {
  x > y && (x = y);
}
const int N = 1000005, P = 1e9 + 7;
long long f[N], inv2 = (P + 1) / 2, n;
long long F[18][131072], A[131072], B[131072], C[131072], T[131072];
int siz[N], cnt[N];
inline void add(long long &x, long long y) { x += y, x >= P && (x -= y); }
inline void fwt_or(long long *f, int len, long long x = 1) {
  for (int p = 2, k = 1; p <= len; p <<= 1, k <<= 1)
    for (int i = 0; i < len; i += p)
      for (int j = 0; j < k; j++)
        if (~x)
          f[i + j + k] = (f[i + j + k] + f[i + j]) % P;
        else
          f[i + j + k] = (f[i + j + k] - f[i + j] + P) % P;
}
inline void fwt_and(long long *f, int len, long long x = 1) {
  for (int p = 2, k = 1; p <= len; p <<= 1, k <<= 1)
    for (int i = 0; i < len; i += p)
      for (int j = 0; j < k; j++)
        if (~x)
          f[i + j] = (f[i + j + k] + f[i + j]) % P;
        else
          f[i + j] = (f[i + j] - f[i + j + k] + P) % P;
}
inline void fwt_xor(long long *f, int len, long long opt = 1) {
  for (int p = 2, k = 1; p <= len; p <<= 1, k <<= 1)
    for (int i = 0; i < len; i += p)
      for (int j = 0; j < k; j++) {
        long long x = f[i + j], y = f[i + j + k];
        f[i + j] = (x + y) % P;
        f[i + j + k] = (x + P - y) % P;
        if (opt == -1)
          f[i + j] = f[i + j] * inv2 % P,
                f[i + j + k] = f[i + j + k] * inv2 % P;
      }
}
int main() {
  read(n);
  f[1] = siz[1] = 1;
  for (int i = 2; i < 131072; i++) {
    f[i] = (f[i - 1] + f[i - 2]) % P;
    siz[i] = siz[i >> 1] + (i & 1);
  }
  for (int i = 1, s; i <= n; i++) read(s), F[siz[s]][s]++, B[s]++, C[s]++;
  int len = 1 << 17;
  fwt_xor(C, len, 1);
  for (int i = 0; i < len; i++) C[i] = C[i] * C[i] % P;
  fwt_xor(C, len, -1);
  for (int i = 0; i <= 17; i++) {
    fwt_or(F[i], len, 1);
    for (int j = 0; j < len; j++) T[j] = 0;
    for (int k = 0; k <= i; k++)
      for (int j = 0; j < len; j++) T[j] = (T[j] + F[i - k][j] * F[k][j]) % P;
    fwt_or(T, len, -1);
    for (int j = 0; j < len; j++)
      if (siz[j] == i) A[j] = (A[j] + T[j]) % P;
  }
  for (int j = 0; j < len; j++)
    A[j] = A[j] * f[j] % P, B[j] = B[j] * f[j] % P, C[j] = C[j] * f[j] % P;
  fwt_and(A, len, 1), fwt_and(B, len, 1), fwt_and(C, len, 1);
  for (int j = 0; j < len; j++) A[j] = A[j] * B[j] % P * C[j] % P;
  fwt_and(A, len, -1);
  long long ans = 0;
  for (int i = 1; i < len; i <<= 1) ans = (ans + A[i]) % P;
  write(ans);
  return 0;
}