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 P = 1e9 + 7;
const int M = 500001;
int n, m, k, b[M], c[M], d[M], e[M], f[M], len = 1;
void Xor(int *a, int inv) {
  for (int m = 1; m < len; m <<= 1) {
    for (int i = 0; i < len; i += (m << 1))
      for (int j = 0; j < m; j++) {
        int x = a[m + i + j];
        a[m + i + j] = ((long long)a[i + j] - x + P) * inv % P;
        a[i + j] = ((long long)a[i + j] + x) * inv % P;
      }
  }
}
void fmt(int *a, int op) {
  for (int i = 0; i <= m; i++)
    for (int s = 0; s < len; s++)
      if (s & (1 << i)) {
        a[s] = a[s] + op * a[s ^ (1 << i)];
        if (a[s] >= P) a[s] -= P;
        if (a[s] < 0) a[s] += P;
      }
}
void fmtand(int *a, int op) {
  for (int i = 0; i <= m; i++)
    for (int s = len - 1; s >= 0; s--)
      if (!(s & (1 << i))) {
        a[s] = a[s] + op * a[s ^ (1 << i)];
        if (a[s] >= P) a[s] -= P;
        if (a[s] < 0) a[s] += P;
      }
}
int main() {
  scanf("%d", &n);
  m = -1;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &k), b[k]++;
    while (k >= len) len <<= 1, m++;
  }
  int T = len - 1;
  f[1] = 1;
  for (int i = 2; i < len; i++) f[i] = (f[i - 1] + f[i - 2]) % P;
  for (int i = 0; i < len; i++) {
    c[i] = (c[i] + (long long)b[0] * b[i]) % P;
    c[i] = (long long)c[i] * f[i] % P;
    int t = T - i;
    if (b[i])
      for (int j = t; j; j = (j - 1) & t)
        c[j | i] = (c[j | i] + (long long)b[i] * b[j]) % P;
  }
  memcpy(d, b, sizeof(d));
  Xor(d, 1);
  for (int i = 0; i <= len; i++) d[i] = (long long)d[i] * d[i] % P;
  Xor(d, (P + 1) / 2);
  for (int i = 0; i <= len; i++) d[i] = (long long)d[i] * f[i] % P;
  for (int i = 0; i < len; i++) e[i] = (long long)b[i] * f[i] % P;
  fmtand(c, 1);
  fmtand(e, 1);
  fmtand(d, 1);
  for (int i = 0; i <= len; i++) c[i] = (long long)c[i] * e[i] % P * d[i] % P;
  fmtand(c, -1);
  int ans = 0;
  for (int i = 1; i < len; i++)
    if (i == (i & -i)) ans = (ans + c[i]) % P;
  printf("%d\n", ans);
}