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 M = 17;
const int U = 1 << M;
const long long mod = 1e9 + 7;
inline void MOD(int &x) {
  if (x >= mod) x -= mod;
}
inline void MOD(long long &x) {
  if (x >= mod) x -= mod;
}
int read() {
  int ans;
  char ch;
  while ((ch = getchar()) < '0' || ch > '9')
    ;
  ans = ch - '0';
  while ((ch = getchar()) >= '0' && ch <= '9') ans = ans * 10 + ch - '0';
  return ans;
}
int n;
int F[U + 5], cnt[U + 5];
int c[U + 5], a[U + 5];
long long d[U + 5], g[M + 2][U + 5], h[M + 2][U + 5];
int main() {
  cnt[1] = F[1] = 1;
  for (int i = 2; i < U; i++) {
    cnt[i] = cnt[i >> 1] + (i & 1);
    MOD(F[i] = F[i - 1] + F[i - 2]);
  }
  n = read();
  for (int x, i = 1; i <= n; i++) {
    x = read();
    MOD(c[x] += F[x]);
    d[x]++;
    g[cnt[x]][x]++;
  }
  for (int len = 2; len <= U; len <<= 1)
    for (int m = len >> 1, i = 0; i < U; i += len)
      for (int j = 0; j < m; j++) {
        long long x = d[i + j], y = d[i + j + m];
        d[i + j] = x + y;
        d[i + j + m] = x - y;
      }
  for (int i = 0; i < U; i++) d[i] = d[i] * d[i];
  for (int len = U; len >= 2; len >>= 1)
    for (int m = len >> 1, i = 0; i < U; i += len)
      for (int j = 0; j < m; j++) {
        long long x = d[i + j], y = d[i + j + m];
        d[i + j] = (x + y) >> 1;
        d[i + j + m] = (x - y) >> 1;
      }
  for (int i = 0; i < U; i++) d[i] = d[i] % mod * F[i] % mod;
  for (int i = 1; i < U; i++) g[0][i] = g[0][0];
  for (int i = 0; i <= M; i++) {
    if (i != 0)
      for (int j = 0; j < M; j++)
        for (int k = 0; k < U; k++)
          if (k & (1 << j)) g[i][k] += g[i][k ^ (1 << j)];
    for (int j = 0; j < U; j++)
      for (int k = 0; k <= i; k++) h[i][j] = h[i][j] + g[k][j] * g[i - k][j];
    for (int j = 0; j < M; j++)
      for (int k = 0; k < U; k++)
        if (k & (1 << j)) h[i][k] -= h[i][k ^ (1 << j)];
  }
  for (int i = 0; i < U; i++) a[i] = h[cnt[i]][i] % mod * F[i] % mod;
  for (int j = 0; j < M; j++)
    for (int k = 0; k < U; k++)
      if (!(k & (1 << j))) {
        MOD(c[k] += c[k ^ (1 << j)]);
        MOD(a[k] += a[k ^ (1 << j)]);
        MOD(d[k] += d[k ^ (1 << j)]);
      }
  for (int i = 0; i < U; i++) a[i] = (long long)a[i] * c[i] % mod * d[i] % mod;
  for (int j = 0; j < M; j++)
    for (int k = 0; k < U; k++)
      if (!(k & (1 << j))) MOD(a[k] += mod - a[k ^ (1 << j)]);
  int ans = 0;
  for (int i = 0; i < M; i++) MOD(ans += a[1 << i]);
  printf("%d\n", ans);
  return 0;
}