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>
#pragma GCC optimize("O2,unroll-loops")
using namespace std;
const int mod = 1000000007, N = 17;
int n, x, ans;
int A[1 << N], B[N + 1][1 << N], C[N + 1][1 << N], D[1 << N], E[1 << N];
long long fib[1 << N];
inline void fix(int& x) {
  if (x >= mod) x -= mod;
  if (x < 0) x += mod;
}
void SOS1(int* A, int inv) {
  for (int j = 0; j < N; j++)
    for (int mask = 0; mask < (1 << N); mask++)
      if (mask & (1 << j)) fix(A[mask] += inv * A[mask ^ (1 << j)]);
}
void SOS2(int* A, int inv) {
  for (int j = 0; j < N; j++)
    for (int mask = 0; mask < (1 << N); mask++)
      if (mask & (1 << j)) fix(A[mask ^ (1 << j)] += inv * A[mask]);
}
void XOR(int* A, bool inv) {
  for (int j = 0; j < N; j++)
    for (int mask = 0; mask < (1 << N); mask++)
      if (mask & (1 << j)) {
        int a = A[mask ^ (1 << j)], b = A[mask];
        fix(A[mask ^ (1 << j)] = a + b);
        fix(A[mask] = a - b);
      }
  if (inv) {
    long long tmp = 1, inv2 = (mod + 1) / 2;
    for (int i = 0; i < N; i++) tmp = tmp * inv2 % mod;
    for (int mask = 0; mask < (1 << N); mask++) A[mask] = A[mask] * tmp % mod;
  }
}
int main() {
  fib[1] = 1;
  for (int i = 2; i < (1 << N); i++) fib[i] = (fib[i - 1] + fib[i - 2]) % mod;
  scanf("%d", &n);
  while (n--) scanf("%d", &x), A[x]++;
  for (int i = 0; i <= N; i++) {
    for (int mask = 0; mask < (1 << N); mask++)
      if (__builtin_popcount(mask) == i) B[i][mask] = A[mask];
    SOS1(B[i], +1);
  }
  for (int i = 0; i <= N; i++)
    for (int j = 0; i + j <= N; j++) {
      for (int mask = 0; mask < (1 << N); mask++)
        C[i + j][mask] = (C[i + j][mask] + 1ll * B[i][mask] * B[j][mask]) % mod;
    }
  for (int i = 0; i <= N; i++) SOS1(C[i], -1);
  for (int mask = 0; mask < (1 << N); mask++)
    D[mask] = C[__builtin_popcount(mask)][mask] * fib[mask] % mod;
  for (int mask = 0; mask < (1 << N); mask++) {
    E[mask] = A[mask];
    A[mask] = A[mask] * fib[mask] % mod;
  }
  XOR(E, 0);
  for (int mask = 0; mask < (1 << N); mask++)
    E[mask] = 1ll * E[mask] * E[mask] % mod;
  XOR(E, 1);
  for (int mask = 0; mask < (1 << N); mask++)
    E[mask] = E[mask] * fib[mask] % mod;
  SOS2(A, +1);
  SOS2(D, +1);
  SOS2(E, +1);
  for (int mask = 0; mask < (1 << N); mask++)
    A[mask] = 1ll * A[mask] * D[mask] % mod * E[mask] % mod;
  SOS2(A, -1);
  for (int i = 0; i < N; i++) fix(ans += A[1 << i]);
  if (ans < 0) ans += mod;
  printf("%d\n", ans);
  return 0;
}