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 SZ = 17, N = 1 << SZ;
int Rev(int x) {
  int i, r = 0;
  for (i = 0; i < SZ; i++) {
    r = r << 1 | (x & 1);
    x >>= 1;
  }
  return r;
}
void FFT(long long *a, bool f) {
  int i, j, k;
  long long z;
  for (i = 0; i < N; i++) {
    j = Rev(i);
    if (i < j) {
      z = a[i];
      a[i] = a[j];
      a[j] = z;
    }
  }
  for (i = 1; i < N; i <<= 1)
    for (j = 0; j < N; j += i << 1)
      for (k = 0; k < i; k++) {
        z = a[i + j + k];
        a[i + j + k] = a[j + k] - z;
        a[j + k] += z;
      }
  if (f)
    for (i = 0; i < N; i++) a[i] /= N;
}
const int MOD = 1e9 + 7;
long long X[3][N], Y[3][N], Z[N];
long long S[N];
long long F[N + 10];
void solve() {
  F[0] = 0, F[1] = 1;
  for (int i = 2; i < N + 10; i++) F[i] = (F[i - 1] + F[i - 2]) % MOD;
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    int x;
    scanf("%d", &x);
    S[x]++;
  }
  for (int i = 0; i < N; i++) X[1][i] = S[i];
  for (int i = 0; i < N; i++) {
    int ni = (N - 1 - i);
    for (int j = i;; j = (j - 1) & i) {
      X[0][ni | j] += S[ni] * S[j];
      if (j == 0) break;
    }
  }
  FFT(S, false);
  for (int i = 0; i < N; i++) S[i] *= S[i];
  FFT(S, true);
  for (int i = 0; i < N; i++) X[2][i] = S[i];
  for (int u = 0; u < 3; u++)
    for (int i = 0; i < N; i++) {
      X[u][i] %= MOD;
      X[u][i] = X[u][i] * F[i] % MOD;
    }
  for (int u = 0; u < 3; u++) {
    for (int i = 0; i < N; i++) {
      for (int j = i;; j = (j - 1) & i) {
        Y[u][j] += X[u][i];
        if (j == 0) break;
      }
    }
    for (int i = 0; i < N; i++) Y[u][i] %= MOD;
  }
  for (int i = 0; i < N; i++) Z[i] = Y[0][i] * Y[1][i] % MOD * Y[2][i] % MOD;
  for (int i = 1; i < N; i++) {
    int ni = N - 1 - i;
    for (int j = (i - 1) & i;; j = (j - 1) & i) {
      int nj = N - 1 - j;
      Z[ni] -= Z[nj];
      if (j == 0) break;
    }
  }
  for (int i = 0; i < N; i++) Z[i] = (Z[i] % MOD + MOD) % MOD;
  long long ans = 0;
  for (int i = 0; i < SZ; i++) ans = (ans + Z[1 << i]) % MOD;
  printf("%lld\n", ans);
}
int main() {
  int Tc = 1;
  for (int tc = 1; tc <= Tc; tc++) {
    solve();
  }
  return 0;
}