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 <typename A, typename B>
inline void chmin(A &a, B b) {
  if (a > b) a = b;
}
template <typename A, typename B>
inline void chmax(A &a, B b) {
  if (a < b) a = b;
}
long long N;
long long A[1111111];
long long cnt[1 << 17];
long long cntX[1 << 17];
long long cntY[1 << 17];
const long long mod = 1000000007;
inline void add(long long &a, long long b) {
  a += b;
  if (a >= mod) a -= mod;
}
vector<long long> FWHT(vector<long long> P, bool inverse) {
  for (long long len = 1; 2 * len <= P.size(); len <<= 1) {
    for (long long i = 0; i < P.size(); i += 2 * len) {
      for (long long j = 0; j < len; j++) {
        long long u = P[i + j];
        long long v = P[i + len + j];
        P[i + j] = u + v;
        P[i + len + j] = u - v;
      }
    }
  }
  if (inverse) {
    for (long long i = 0; i < P.size(); i++) P[i] = P[i] / P.size();
  }
  return P;
}
void zeta(long long f[1 << 17]) {
  for (long long i = 0; i < (17); i++)
    for (long long b = 0; b < (1 << 17); b++)
      if (0 == (b & (1 << i))) f[b] += f[b | (1 << i)];
}
void me(long long f[1 << 17]) {
  for (long long i = 0; i < (17); i++)
    for (long long b = 0; b < (1 << 17); b++)
      if (b & (1 << i)) f[b] -= f[b ^ (1 << i)];
}
long long fib[1 << 17];
signed main() {
  fib[0] = 0;
  fib[1] = 1;
  for (long long i = 2; i < 1 << 17; i++)
    fib[i] = (fib[i - 1] + fib[i - 2]) % mod;
  scanf("%lld", &N);
  for (long long i = 0; i < (N); i++) {
    scanf("%lld", &A[i]);
    cnt[A[i]]++;
  }
  for (long long i = 0; i < (1 << 17); i++) {
    long long sup = (1 << 17) - 1 - i;
    long long sub = sup;
    do {
      cntX[i | sub] += cnt[i] * cnt[sub];
      sub = (sub - 1) & sup;
    } while (sub != sup);
  }
  for (long long i = 0; i < (1 << 17); i++) cntX[i] %= mod;
  vector<long long> P(1 << 17);
  for (long long i = 0; i < (1 << 17); i++) P[i] = cnt[i];
  P = FWHT(P, false);
  for (long long i = 0; i < (P.size()); i++) P[i] = P[i] * P[i];
  P = FWHT(P, true);
  for (long long i = 0; i < (1 << 17); i++) cntY[i] = P[i] % mod;
  for (long long i = 0; i < (1 << 17); i++) {
    cnt[i] = cnt[i] * fib[i] % mod;
    cntX[i] = cntX[i] * fib[i] % mod;
    cntY[i] = cntY[i] * fib[i] % mod;
  }
  zeta(cnt);
  zeta(cntX);
  zeta(cntY);
  for (long long i = 0; i < (1 << 17); i++) {
    cnt[i] = (cnt[i] % mod + mod) % mod;
    cntX[i] = (cntX[i] % mod + mod) % mod;
    cntY[i] = (cntY[i] % mod + mod) % mod;
    cnt[i] = cnt[i] * cntX[i] % mod * cntY[i] % mod;
  }
  for (long long i = 0; i < 1 << 16; i++) swap(cnt[i], cnt[(1 << 17) - 1 - i]);
  me(cnt);
  for (long long i = 0; i < 1 << 16; i++) swap(cnt[i], cnt[(1 << 17) - 1 - i]);
  long long ans = 0;
  for (long long i = 1; i < 1 << 17; i <<= 1) {
    cnt[i] = (cnt[i] % mod + mod) % mod;
    ans = (ans + cnt[i]) % mod;
  }
  cout << ans << endl;
  return 0;
}