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 inv2 = (1000000007 + 1) / 2;
long long c[150050], f1[150050], g[20][150050], cnt[150050], f[20][150050],
    fib[150050], f2[150050], f3[150050];
void fwt_or(long long *a, int len, int flg) {
  int i, j, k, t;
  for (k = 2; k <= len; k <<= 1) {
    for (t = k >> 1, i = 0; i < len; i += k)
      for (j = i; j < i + t; j++) {
        if (flg == 1)
          a[j + t] = (a[j + t] + a[j]) % 1000000007;
        else
          a[j + t] = (a[j + t] - a[j]) % 1000000007;
      }
  }
}
void fwt_and(long long *a, int len, int flg) {
  int i, j, k, t;
  for (k = 2; k <= len; k <<= 1) {
    for (t = k >> 1, i = 0; i < len; i += k)
      for (j = i; j < i + t; j++) {
        if (flg == 1)
          a[j] = (a[j] + a[j + t]) % 1000000007;
        else
          a[j] = (a[j] - a[j + t]) % 1000000007;
      }
  }
}
void fwt_xor(long long *a, int len, int flg) {
  int i, j, k, t;
  long long tmp;
  for (k = 2; k <= len; k <<= 1) {
    for (t = k >> 1, i = 0; i < len; i += k)
      for (j = i; j < i + t; j++) {
        tmp = a[j + t];
        a[j + t] = (a[j] - tmp) % 1000000007;
        a[j] = (a[j] + tmp) % 1000000007;
        if (flg == -1)
          a[j] = a[j] * inv2 % 1000000007,
          a[j + t] = a[j + t] * inv2 % 1000000007;
      }
  }
}
int main() {
  int n;
  scanf("%d", &n);
  int i, x, l = 1, mx = 0, j, k;
  for (i = 1; i <= n; i++) {
    scanf("%d", &x);
    c[x]++;
    mx = max(mx, x);
  }
  while (l <= mx) l <<= 1;
  fib[1] = 1;
  for (i = 2; i < l; i++) fib[i] = (fib[i - 1] + fib[i - 2]) % 1000000007;
  for (i = 1; i < l; i++) cnt[i] = cnt[i >> 1] + (i & 1);
  memcpy(f1, c, sizeof(long long) * l);
  for (i = 0; i < l; i++) g[cnt[i]][i] = c[i];
  int lim = cnt[l - 1];
  for (i = 0; i <= lim; i++) fwt_or(g[i], l, 1);
  for (i = 0; i < l; i++)
    for (j = 0; j <= lim; j++)
      if (g[j][i])
        for (k = 0; j + k <= lim; k++)
          if (g[k][i]) {
            f[j + k][i] = (f[j + k][i] + g[j][i] * g[k][i]) % 1000000007;
          }
  for (i = 0; i <= lim; i++) fwt_or(f[i], l, -1);
  for (i = 0; i < l; i++) f1[i] = f[cnt[i]][i] * fib[i] % 1000000007;
  for (i = 0; i < l; i++) f2[i] = c[i] * fib[i] % 1000000007;
  memcpy(f3, c, sizeof(long long) * l);
  fwt_xor(f3, l, 1);
  for (i = 0; i < l; i++) f3[i] = f3[i] * f3[i] % 1000000007;
  fwt_xor(f3, l, -1);
  for (i = 0; i < l; i++) f3[i] = f3[i] * fib[i] % 1000000007;
  fwt_and(f1, l, 1);
  fwt_and(f2, l, 1);
  fwt_and(f3, l, 1);
  for (i = 0; i < l; i++)
    f1[i] = f1[i] * f2[i] % 1000000007 * f3[i] % 1000000007;
  fwt_and(f1, l, -1);
  long long ans = 0;
  for (i = 0; i <= lim; i++) {
    ans = (ans + f1[1 << i]) % 1000000007;
  }
  printf("%lld\n", (ans + 1000000007) % 1000000007);
}