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 N = 131079, P = 1e9 + 7;
int n = 1, h[N], a[21][N], y[N], z[N], p[N], f[N], x[N];
void OR(int* a, int b) {
  int i, j, k, l, p;
  for (i = 1; i < n; i *= 2)
    for (j = 0, l = i * 2; j < n; j += l)
      for (k = j, p = j + i; k < p; ++k) a[i + k] = (a[i + k] + a[k] * b) % P;
}
void AND(int* a, int b) {
  int i, j, k, l, p;
  for (i = 1; i < n; i *= 2)
    for (j = 0, l = i * 2; j < n; j += l)
      for (k = j, p = j + i; k < p; ++k) a[k] = (a[k] + a[i + k] * b) % P;
}
void XOR(int* a, int b) {
  int i, j, k, l, p, w;
  for (i = 1; i < n; i *= 2)
    for (j = 0, l = i * 2; j < n; j += l)
      for (k = j, p = j + i; k < p; ++k)
        w = a[i + k], a[i + k] = (a[k] - w) * 1ll * b % P,
        a[k] = (a[k] + w) * 1ll * b % P;
}
int main() {
  int m, w = 0, i, j, k, t = 0;
  scanf("%d", &m), f[1] = p[1] = 1;
  for (i = 0; i < m; ++i) scanf("%d", &j), ++z[j], w = max(w, j);
  while (n <= w) n <<= 1, ++t;
  for (i = 2; i < n; ++i)
    f[i] = (f[i - 1] + f[i - 2]) % P, p[i] = p[i >> 1] + (i & 1);
  for (i = 0; i < n; ++i) a[p[i]][i] = z[i], y[i] = z[i] * 1ll * f[i] % P;
  for (i = 0; i <= t; ++i) OR(a[i], 1);
  for (i = 0; i <= t; ++i) {
    memset(h, 0, n << 2);
    for (j = 0; j <= i; ++j)
      for (k = 0; k < n; ++k) h[k] = (h[k] + a[j][k] * 1ll * a[i - j][k]) % P;
    OR(h, -1);
    for (j = 0; j < n; ++j)
      if (p[j] == i) x[j] = h[j] * 1ll * f[j] % P;
  }
  XOR(z, 1);
  for (i = 0; i < n; ++i) z[i] = z[i] * 1ll * z[i] % P;
  XOR(z, P + 1 >> 1);
  for (i = 0; i < n; ++i) z[i] = z[i] * 1ll * f[i] % P;
  AND(x, 1), AND(y, 1), AND(z, 1);
  for (i = 0; i < n; ++i) x[i] = x[i] * 1ll * y[i] % P * z[i] % P;
  AND(x, -1);
  for (i = w = 0; i <= t; ++i) w = (w + x[1 << i]) % P;
  printf("%d", (w + P) % P);
  return 0;
}