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;
const int INF = 2147483647;
const int mod = 1e9 + 7;
const int maxn = 1 << 17;
const int inv = 5e8 + 4;
long long F[maxn], C[maxn], D[maxn], E[maxn], AorB[maxn], DxorE[maxn],
    ans[maxn];
void fwt_xor(long long *A, int l, int r, int mode) {
  if (r - l == 1) return;
  int len = (r - l) >> 1;
  fwt_xor(A, l, l + len, mode);
  fwt_xor(A, l + len, r, mode);
  for (int i = l; i < l + len; i++) {
    A[i] = (A[i] + A[i + len]) % mod;
    A[i + len] = (A[i] - A[i + len] * 2) % mod;
    if (A[i + len] < 0) A[i + len] += mod;
    if (mode) {
      A[i] = (A[i] * inv) % mod;
      A[i + len] = (A[i + len] * inv) % mod;
    }
  }
}
void fwt_and(long long *A, int l, int r, int mode) {
  if (r - l == 1) return;
  int len = (r - l) >> 1;
  fwt_and(A, l, l + len, mode);
  fwt_and(A, l + len, r, mode);
  for (int i = l; i < l + len; i++) {
    A[i] = (A[i] + A[i + len] * mode) % mod;
    if (A[i] < 0) A[i] += mod;
  }
}
int main() {
  F[0] = 0, F[1] = 1;
  for (int i = 2; i < maxn; i++) F[i] = (F[i - 1] + F[i - 2]) % mod;
  int n;
  scanf("%d", &n);
  while (n--) {
    int x;
    scanf("%d", &x);
    C[x]++;
  }
  for (int i = 0; i < maxn; i++) E[i] = D[i] = C[i];
  for (int i = 0; i < maxn; i++) {
    AorB[i] = (C[0] * C[i]) % mod;
    for (int j = i; j; j = (j - 1) & i) {
      AorB[i] = (AorB[i] + C[j] * C[i ^ j]) % mod;
    }
    AorB[i] = (AorB[i] * F[i]) % mod;
  }
  for (int i = 0; i < maxn; i++) C[i] = (C[i] * F[i]) % mod;
  fwt_xor(D, 0, maxn, 0), fwt_xor(E, 0, maxn, 0);
  for (int i = 0; i < maxn; i++) DxorE[i] = (D[i] * E[i]) % mod;
  fwt_xor(DxorE, 0, maxn, 1);
  for (int i = 0; i < maxn; i++) DxorE[i] = (DxorE[i] * F[i]) % mod;
  fwt_and(AorB, 0, maxn, 1), fwt_and(C, 0, maxn, 1), fwt_and(DxorE, 0, maxn, 1);
  for (int i = 0; i < maxn; i++) {
    ans[i] = (((AorB[i] * C[i]) % mod) * DxorE[i]) % mod;
  }
  fwt_and(ans, 0, maxn, -1);
  long long res = 0;
  for (int i = 1; i < maxn; i <<= 1) res = (res + ans[i]) % mod;
  printf("%lld\n", res);
  return 0;
}