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;
long long mul(long long a, long long b) {
  if (!b) return 1;
  long long k = mul(a, b / 2);
  if (b & 1) return k * k % 1000000007 * a % 1000000007;
  return k * k % 1000000007;
}
inline char gc() {
  static char buf[262144], *head = buf, *tail = buf;
  return head == tail && (tail = (head = buf) + fread(buf, 1, 262144, stdin),
                          head == tail)
             ? EOF
             : *head++;
}
inline int read() {
  int ret = 0;
  char ch = gc();
  while (ch < '0' || ch > '9') ch = gc();
  while (ch >= '0' && ch <= '9') ret = ret * 10 + ch - '0', ch = gc();
  return ret;
}
int n, N;
long long f[20][200010], g[20][200010], fib[200010];
long long a[200010], b[200010], c[200010];
void init_fib() {
  fib[0] = 0, fib[1] = 1;
  for (int i = 2; i < (1 << 17); i++)
    fib[i] = (fib[i - 1] + fib[i - 2]) % 1000000007;
}
void FWT_or(long long *v, int dir) {
  for (int i = 1; i < N; i <<= 1)
    for (int j = 0; j < N; j += i * 2)
      for (int k = 0; k < i; k++) {
        long long x = v[j + k], y = v[j + k + i];
        v[j + k] = x, v[j + k + i] = (dir * x + y + 1000000007) % 1000000007;
      }
}
void FWT_and(long long *v, int dir) {
  for (int i = 1; i < N; i <<= 1)
    for (int j = 0; j < N; j += i * 2)
      for (int k = 0; k < i; k++) {
        long long x = v[j + k], y = v[j + k + i];
        v[j + k] = (x + dir * y + 1000000007) % 1000000007, v[j + k + i] = y;
      }
}
void FWT_xor(long long *v, int dir) {
  long long inv2 = mul(2, 1000000007 - 2);
  for (int i = 1; i < N; i <<= 1)
    for (int j = 0; j < N; j += i * 2)
      for (int k = 0; k < i; k++) {
        long long x = v[j + k], y = v[j + k + i];
        v[j + k] = (x + y) * (dir == -1 ? inv2 : 1) % 1000000007;
        v[j + k + i] =
            (x - y + 1000000007) * (dir == -1 ? inv2 : 1) % 1000000007;
      }
}
int main() {
  init_fib();
  n = read();
  N = 1;
  for (int i = 1; i <= n; i++) {
    int x = read();
    while (N <= x) N <<= 1;
    g[__builtin_popcount(x)][x]++;
    b[x]++, c[x]++;
  }
  for (int i = 0; i <= 17; i++) FWT_or(g[i], 1);
  for (int i = 0; i <= 17; i++) {
    for (int j = 0; j <= i; j++)
      for (int k = 0; k < N; k++)
        (f[i][k] += (g[j][k] * g[i - j][k]) % 1000000007) %= 1000000007;
    FWT_or(f[i], -1);
    for (int j = 0; j < N; j++) {
      if (__builtin_popcount(j) == i) continue;
      f[i][j] = 0;
    }
  }
  for (int i = 0; i <= 17; i++)
    for (int j = 0; j < N; j++) (a[j] += f[i][j]) %= 1000000007;
  FWT_xor(c, 1);
  for (int i = 0; i < N; i++) (c[i] *= c[i]) %= 1000000007;
  FWT_xor(c, -1);
  for (int i = 0; i < N; i++) {
    (a[i] *= fib[i]) %= 1000000007;
    (b[i] *= fib[i]) %= 1000000007;
    (c[i] *= fib[i]) %= 1000000007;
  }
  FWT_and(a, 1), FWT_and(b, 1), FWT_and(c, 1);
  for (int i = 0; i < N; i++)
    (a[i] *= (b[i] * c[i] % 1000000007)) %= 1000000007;
  FWT_and(a, -1);
  long long ans = 0;
  for (int i = 1; i < N; i <<= 1) (ans += a[i]) %= 1000000007;
  cout << ans << endl;
  return 0;
}