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 long long mod = 1000000007;
const int B = 17;
const int N = (1 << B);
long long pw(long long a, long long b) {
  long long res = 1;
  while (b != 0) {
    if (b % 2 == 1) (res *= a) %= mod;
    (a *= a) %= mod;
    b /= 2;
  }
  return res;
}
inline void normalize(long long& x) {
  if (x < 0) x += mod;
  if (x >= mod) x -= mod;
}
void transform(vector<long long>& A, long long a1, long long a2, long long a3,
               long long a4) {
  long long a, b;
  int i, j, k;
  for (k = 1; k < N; k *= 2)
    for (j = 0; j < N; j += 2 * k)
      for (i = j; i < j + k; i++) {
        a = A[i];
        b = A[i + k];
        A[i] = (a1 * a + a2 * b) % mod;
        A[i + k] = (a3 * a + a4 * b) % mod;
        normalize(A[i]);
        normalize(A[i + k]);
      }
}
vector<long long> xor_convolution(vector<long long> a, vector<long long> b) {
  transform(a, 1, 1, 1, -1);
  transform(b, 1, 1, 1, -1);
  vector<long long> c(N);
  int i;
  for (i = 0; i < N; i++) c[i] = (a[i] * b[i]) % mod;
  transform(c, 1, 1, 1, -1);
  for (i = 0; i < N; i++) (c[i] *= pw(N, mod - 2)) %= mod;
  return c;
}
vector<long long> and_convolution(vector<long long> a, vector<long long> b) {
  transform(a, 0, 1, 1, 1);
  transform(b, 0, 1, 1, 1);
  vector<long long> c(N);
  for (int i = 0; i < N; i++) c[i] = (a[i] * b[i]) % mod;
  transform(c, -1, 1, 1, 0);
  return c;
}
void mobius(long long* A, bool reverse) {
  int i, j;
  for (j = 0; j <= B; j++)
    for (i = 0; i < N; i++)
      if ((i >> j) & 1) {
        A[i] += (reverse ? -1 : 1) * A[i ^ (1 << j)];
        normalize(A[i]);
      }
}
long long da[B + 1][N];
long long db[B + 1][N];
long long dc[B + 1][N];
vector<long long> subset_convolution(vector<long long> a, vector<long long> b) {
  int i, j, k;
  for (i = 0; i < N; i++) {
    da[__builtin_popcount(i)][i] = a[i];
    db[__builtin_popcount(i)][i] = b[i];
  }
  for (j = 0; j <= B; j++) {
    mobius(da[j], false);
    mobius(db[j], false);
  }
  for (i = 0; i < N; i++)
    for (j = 0; j <= B; j++)
      for (k = 0; k <= j; k++) (dc[j][i] += da[k][i] * db[j - k][i]) %= mod;
  for (j = 0; j <= B; j++) mobius(dc[j], true);
  vector<long long> c(N);
  for (i = 0; i < N; i++) c[i] = dc[__builtin_popcount(i)][i];
  return c;
}
long long fib[N];
vector<long long> P1, P2, P3;
int main() {
  P1 = vector<long long>(N, 0);
  int i, n, x;
  scanf("%d", &n);
  while (n--) {
    scanf("%d", &x);
    P1[x]++;
  }
  P2 = subset_convolution(P1, P1);
  P3 = xor_convolution(P1, P1);
  fib[0] = 0;
  fib[1] = 1;
  for (i = 2; i < N; i++) fib[i] = (fib[i - 1] + fib[i - 2]) % mod;
  for (i = 0; i < N; i++) {
    (P1[i] *= fib[i]) %= mod;
    (P2[i] *= fib[i]) %= mod;
    (P3[i] *= fib[i]) %= mod;
  }
  P1 = and_convolution(P1, P2);
  P1 = and_convolution(P1, P3);
  long long out = 0;
  for (i = 1; i < N; i *= 2) (out += P1[i]) %= mod;
  printf("%lld\n", out);
  return 0;
}