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 <class T>
inline void read(T& x) {
  int f = 1;
  x = 0;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  x *= f;
}
const int N = (1 << 17) + 5;
const int mo = 1000000007;
int n;
int a[N], f[N];
int F[N][18];
int R[N], E[N], M[N];
int A[18], B[18];
void FWT_or(int F[][18], int n) {
  for (int m = 2; m <= n; m <<= 1) {
    for (int i = 0; i < n; i += m) {
      for (int j = i; j < i + m / 2; j++) {
        memset(A, 0, sizeof A);
        memset(B, 0, sizeof B);
        for (int p = 0; p <= 17; p++)
          A[p] = F[j][p], B[p] = (F[j][p] + F[j + m / 2][p]) % mo;
        for (int p = 0; p <= 17; p++) F[j][p] = A[p], F[j + m / 2][p] = B[p];
      }
    }
  }
}
void IFWT_or(int F[][18], int n) {
  for (int m = 2; m <= n; m <<= 1) {
    for (int i = 0; i < n; i += m) {
      for (int j = i; j < i + m / 2; j++) {
        memset(A, 0, sizeof A);
        memset(B, 0, sizeof B);
        for (int p = 0; p <= 17; p++)
          A[p] = F[j][p], B[p] = (F[j + m / 2][p] - F[j][p]) % mo;
        for (int p = 0; p <= 17; p++) F[j][p] = A[p], F[j + m / 2][p] = B[p];
      }
    }
  }
}
void FWT_xor(int F[], int n) {
  for (int m = 2; m <= n; m <<= 1) {
    for (int i = 0; i < n; i += m) {
      for (int j = i; j < i + m / 2; j++) {
        int u = F[j], v = F[j + m / 2];
        F[j] = (u + v) % mo;
        F[j + m / 2] = (u - v) % mo;
      }
    }
  }
}
void IFWT_xor(int F[], int n) {
  int inv = (mo + 1) / 2;
  for (int m = 2; m <= n; m <<= 1) {
    for (int i = 0; i < n; i += m) {
      for (int j = i; j < i + m / 2; j++) {
        int u = F[j], v = F[j + m / 2];
        F[j] = 1LL * (u + v) * inv % mo;
        F[j + m / 2] = 1LL * (u - v) * inv % mo;
      }
    }
  }
}
void FWT_and(int F[], int n) {
  for (int m = 2; m <= n; m <<= 1) {
    for (int i = 0; i < n; i += m) {
      for (int j = i; j < i + m / 2; j++) {
        int u = F[j], v = F[j + m / 2];
        F[j] = (u + v) % mo;
        F[j + m / 2] = v;
      }
    }
  }
}
void IFWT_and(int F[], int n) {
  for (int m = 2; m <= n; m <<= 1) {
    for (int i = 0; i < n; i += m) {
      for (int j = i; j < i + m / 2; j++) {
        int u = F[j], v = F[j + m / 2];
        F[j] = (u - v) % mo;
        F[j + m / 2] = v;
      }
    }
  }
}
int main() {
  read(n);
  for (int i = 1, x; i <= n; i++) read(x), a[x]++;
  for (int i = 0; i < (1 << 17); i++) F[i][__builtin_popcount(i)] = a[i];
  f[0] = 0, f[1] = 1;
  for (int i = 2; i < (1 << 17); i++) f[i] = (f[i - 1] + f[i - 2]) % mo;
  FWT_or(F, 1 << 17);
  for (int i = 0; i < (1 << 17); i++) {
    memset(A, 0, sizeof A);
    for (int j = 0; j <= 17; j++)
      for (int p = 0; p <= 17; p++)
        if (j + p <= 17) (A[j + p] += 1LL * F[i][j] * F[i][p] % mo) %= mo;
    for (int j = 0; j <= 17; j++) F[i][j] = A[j];
  }
  IFWT_or(F, 1 << 17);
  for (int i = 0; i < (1 << 17); i++)
    R[i] = 1LL * F[i][__builtin_popcount(i)] * f[i] % mo;
  for (int i = 0; i < (1 << 17); i++) E[i] = 1LL * a[i] * f[i] % mo;
  for (int i = 0; i < (1 << 17); i++) M[i] = a[i];
  FWT_xor(M, 1 << 17);
  for (int i = 0; i < (1 << 17); i++) M[i] = 1LL * M[i] * M[i] % mo;
  IFWT_xor(M, 1 << 17);
  for (int i = 0; i < (1 << 17); i++) M[i] = 1LL * M[i] * f[i] % mo;
  FWT_and(R, 1 << 17);
  FWT_and(E, 1 << 17);
  FWT_and(M, 1 << 17);
  for (int i = 0; i < (1 << 17); i++) R[i] = 1LL * R[i] * E[i] % mo * M[i] % mo;
  IFWT_and(R, 1 << 17);
  int ans = 0;
  for (int i = 0; i < 17; i++) (ans += R[1 << i]) %= mo;
  printf("%d\n", (ans + mo) % mo);
  return 0;
}