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;
void fwt_or(long long* a, int n, int fwt) {
  for (int step = 1; step < n; step <<= 1)
    for (int i = 0; i < n; i += step << 1)
      for (int j = i; j < i + step; j++)
        a[j + step] = (a[j + step] + fwt * a[j] + 1000000007) % 1000000007;
  return;
}
void fwt_and(long long* a, int n, int fwt) {
  for (int step = 1; step < n; step <<= 1)
    for (int i = 0; i < n; i += step << 1)
      for (int j = i; j < i + step; j++)
        a[j] = (a[j] + fwt * a[j + step] + 1000000007) % 1000000007;
  return;
}
void fwt_xor(long long* a, int n, int fwt) {
  for (int step = 1; step < n; step <<= 1)
    for (int i = 0; i < n; i += step << 1)
      for (int j = i; j < i + step; j++) {
        long long x = a[j], y = a[j + step];
        a[j] = (x + y) % 1000000007;
        a[j + step] = (x - y + 1000000007) % 1000000007;
        if (fwt == -1)
          a[j] = a[j] * 500000004 % 1000000007,
          a[j + step] = a[j + step] * 500000004 % 1000000007;
      }
  return;
}
int cnt[1 << 17];
long long A[1 << 17], B[1 << 17], C[1 << 17];
int f[1 << 17], siz[1 << 17];
long long x[18][1 << 17], y[18][1 << 17];
int main() {
  int n;
  scanf("%d", &n);
  int mx = 0, N = 0;
  for (int i = 1; i <= n; i++) {
    int a;
    scanf("%d", &a);
    cnt[a]++;
    mx = max(mx, a);
  }
  while (mx) {
    N++;
    mx >>= 1;
  }
  for (int i = 1; i < (1 << N); i++) siz[i] = siz[i >> 1] + (i & 1);
  f[0] = 0;
  f[1] = 1;
  for (int i = 2; i < (1 << N); i++) f[i] = (f[i - 1] + f[i - 2]) % 1000000007;
  for (int i = 0; i < (1 << N); i++) x[siz[i]][i] = cnt[i];
  for (int i = 0; i <= N; i++) fwt_or(x[i], 1 << N, 1);
  for (int i = 0; i <= N; i++)
    for (int j = 0; i + j <= N; j++)
      for (int k = 0; k < (1 << N); k++)
        y[i + j][k] = (y[i + j][k] + x[i][k] * x[j][k]) % 1000000007;
  for (int i = 0; i <= N; i++) fwt_or(y[i], 1 << N, -1);
  for (int i = 0; i < (1 << N); i++) A[i] = y[siz[i]][i] * f[i] % 1000000007;
  for (int i = 0; i < (1 << N); i++) x[0][i] = cnt[i];
  fwt_xor(x[0], 1 << N, 1);
  for (int i = 0; i < (1 << N); i++) x[0][i] = x[0][i] * x[0][i] % 1000000007;
  fwt_xor(x[0], 1 << N, -1);
  for (int i = 0; i < (1 << N); i++) C[i] = x[0][i] * f[i] % 1000000007;
  for (int i = 0; i < (1 << N); i++) B[i] = 1ll * cnt[i] * f[i] % 1000000007;
  fwt_and(A, 1 << N, 1);
  fwt_and(B, 1 << N, 1);
  fwt_and(C, 1 << N, 1);
  for (int i = 0; i < (1 << N); i++)
    A[i] = A[i] * B[i] % 1000000007 * C[i] % 1000000007;
  fwt_and(A, 1 << N, -1);
  int ans = 0;
  for (int i = 0; i < N; i++) ans = (ans + A[1 << i]) % 1000000007;
  printf("%d\n", ans);
  return 0;
}