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 = 1e9 + 7, sizeinv = 742744451, lg = 17, N = 1 << lg;
vector<long long> fast_OR_transform(vector<long long> f, bool inverse = false) {
  for (int i = 0; (1 << i) < f.size(); ++i)
    for (int j = 0; j < f.size(); j += 2 << i)
      for (int k = 0; k < (1 << i); ++k)
        (f[j + k + (1 << i)] += f[j + k] * (inverse ? -1 : 1)) %= mod;
  return f;
}
vector<long long> rev(vector<long long> A) {
  for (int i = 0; i < A.size(); i += 2) swap(A[i], A[i ^ (A.size() - 1)]);
  return A;
}
vector<long long> fast_AND_transform(vector<long long> f,
                                     bool inverse = false) {
  return rev(fast_OR_transform(rev(f), inverse));
}
vector<long long> fast_XOR_transform(vector<long long> f,
                                     bool inverse = false) {
  for (int i = 0; (1 << i) < f.size(); ++i)
    for (int j = 0; j < f.size(); j += 2 << i)
      for (int k = 0; k < (1 << i); ++k) {
        long long u = f[j + k], v = f[j + k + (1 << i)];
        f[j + k + (1 << i)] = (u - v + mod) % mod, f[j + k] = (u + v) % mod;
      }
  if (inverse)
    for (auto &a : f) a = a * sizeinv % mod;
  return f;
}
vector<long long> dot(vector<long long> A, vector<long long> B) {
  for (int i = 0; i < A.size(); ++i) A[i] = A[i] * B[i] % mod;
  return A;
}
long long fibo[N] = {0, 1};
int main() {
  int m, a;
  scanf("%d", &m);
  for (int i = 2; i < N; ++i) fibo[i] = (fibo[i - 1] + fibo[i - 2]) % mod;
  vector<long long> cnt(N, 0), A(N, 0), B(N, 0), C(N, 0);
  vector<long long> div[lg + 1], sum[lg + 1];
  for (int i = 0; i <= lg; ++i) div[i].assign(N, 0), sum[i].assign(N, 0);
  while (m--) scanf("%d", &a), ++cnt[a], ++div[__builtin_popcount(a)][a];
  for (auto &V : div) V = fast_OR_transform(V);
  for (int i = 0; i <= lg; ++i) {
    for (int j = 0; j <= i; ++j)
      for (int k = 0; k < N; ++k)
        (sum[i][k] += (div[j][k] * div[i - j][k])) %= mod;
    sum[i] = fast_OR_transform(sum[i], 1);
  }
  for (int i = 0; i < N; ++i) A[i] = sum[__builtin_popcount(i)][i];
  B = cnt;
  C = fast_XOR_transform(cnt), C = fast_XOR_transform(dot(C, C), 1);
  for (int i = 0; i < N; ++i) {
    A[i] = fibo[i] * A[i] % mod;
    B[i] = fibo[i] * B[i] % mod;
    C[i] = fibo[i] * C[i] % mod;
  }
  A = dot(fast_AND_transform(A),
          dot(fast_AND_transform(B), fast_AND_transform(C)));
  A = fast_AND_transform(A, 1);
  long long ans = 0;
  for (int i = 0; i < lg; ++i) ans = ans + A[1 << i], ans %= mod;
  printf("%lld\n", (ans + mod) % mod);
}