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 MAXN = 1000005;
const int MAXS = 1 << 17;
const int mod = 1e9 + 7;
int n, m, s[MAXN], a[MAXS], b[MAXS], c[MAXS];
void solve_or() {
  for (int s = 0; s < m; ++s)
    for (int t = s;; t = (t - 1) & s) {
      b[s] = (b[s] + 1ll * a[t] * a[s ^ t]) % mod;
      if (!t) break;
    }
}
inline int qpow(int a, int b) {
  int re = 1;
  for (; b; b >>= 1, a = 1ll * a * a % mod)
    if (b & 1) re = 1ll * re * a % mod;
  return re;
}
inline void add(int &x, int y) { x = x + y >= mod ? x + y - mod : x + y; }
inline int pls(int x, int y) { return x + y >= mod ? x + y - mod : x + y; }
void FWT_xor(int *arr, int len, int flg) {
  for (int i = 2, v; i <= len; i <<= 1)
    for (int j = 0; j < len; j += i)
      for (int k = j; k < j + i / 2; ++k)
        arr[k + i / 2] = pls(arr[k], mod - (v = arr[k + i / 2])),
                    add(arr[k], v);
  if (flg == -1) {
    int iv = qpow(len, mod - 2);
    for (int i = 0; i < len; ++i) arr[i] = 1ll * arr[i] * iv % mod;
  }
}
void solve_xor() {
  FWT_xor(a, m, 1);
  for (int i = 0; i < m; ++i) c[i] = 1ll * a[i] * a[i] % mod;
  FWT_xor(a, m, -1), FWT_xor(c, m, -1);
}
int fib[MAXS];
void FWT_and(int *arr, int len, int flg) {
  if (flg == 1)
    for (int i = 2; i <= len; i <<= 1)
      for (int j = 0; j < len; j += i)
        for (int k = j; k < j + i / 2; ++k) add(arr[k], arr[k + i / 2]);
  else
    for (int i = 2; i <= len; i <<= 1)
      for (int j = 0; j < len; j += i)
        for (int k = j; k < j + i / 2; ++k) add(arr[k], mod - arr[k + i / 2]);
}
int main() {
  scanf("%d", &n);
  m = 1;
  for (int i = 1, x; i <= n; ++i) {
    scanf("%d", &x), ++a[x];
    while (m <= x) m <<= 1;
  }
  solve_or();
  solve_xor();
  fib[0] = 0, fib[1] = 1;
  for (int i = 2; i < m; ++i) fib[i] = pls(fib[i - 2], fib[i - 1]);
  for (int i = 0; i < m; ++i)
    a[i] = 1ll * a[i] * fib[i] % mod, b[i] = 1ll * b[i] * fib[i] % mod,
    c[i] = 1ll * c[i] * fib[i] % mod;
  FWT_and(a, m, 1), FWT_and(b, m, 1), FWT_and(c, m, 1);
  for (int i = 0; i < m; ++i) a[i] = 1ll * a[i] * b[i] % mod * c[i] % mod;
  FWT_and(a, m, -1);
  int ans = 0;
  for (int i = 1; i < m; i <<= 1) add(ans, a[i]);
  printf("%d\n", ans);
}