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>
const long long M = 1 << 17;
const long long MOD = 1e9 + 7;
long long read() {
  long long num = 0, flag = 1;
  char c;
  while ((c = getchar()) < '0' || c > '9')
    if (c == '-') flag = -1;
  while (c >= '0' && c <= '9')
    num = (num << 3) + (num << 1) + (c ^ 48), c = getchar();
  return num * flag;
}
long long n, cnt[18][M], f[18][M], inv2 = (MOD + 1) / 2;
long long ans, a[M], b[M], c[M], fb[M], bit[M];
void fwt_or(long long *a, long long n, long long op) {
  for (long long i = 1; i < n; i <<= 1)
    for (long long p = i << 1, j = 0; j < n; j += p)
      for (long long k = 0; k < i; k++) {
        if (op == 1)
          a[i + j + k] = (a[i + j + k] + a[j + k]) % MOD;
        else
          a[i + j + k] = (a[i + j + k] - a[j + k] + MOD) % MOD;
      }
}
void fwt_and(long long *a, long long n, long long op) {
  for (long long i = 1; i < n; i <<= 1)
    for (long long p = i << 1, j = 0; j < n; j += p)
      for (long long k = 0; k < i; k++) {
        if (op == 1)
          a[j + k] = (a[j + k] + a[i + j + k]) % MOD;
        else
          a[j + k] = (a[j + k] - a[i + j + k] + MOD) % MOD;
      }
}
void fwt_xor(long long *a, long long n, long long op) {
  for (long long i = 1; i < n; i <<= 1)
    for (long long p = i << 1, j = 0; j < n; j += p)
      for (long long k = 0; k < i; k++) {
        long long x = a[j + k], y = a[i + j + k];
        a[j + k] = (x + y) % MOD;
        a[i + j + k] = (x + MOD - y) % MOD;
        if (op == -1) {
          a[j + k] = 1ll * a[j + k] * inv2 % MOD;
          a[i + j + k] = 1ll * a[i + j + k] * inv2 % MOD;
        }
      }
}
signed main() {
  n = read();
  for (long long i = 1; i < M; i++) bit[i] = bit[i >> 1] + (i & 1);
  for (long long i = 1; i <= n; i++) {
    long long x = read();
    b[x]++;
    c[x]++;
    cnt[bit[x]][x]++;
  }
  for (long long i = 0; i < 18; i++) fwt_xor(cnt[i], M, 1);
  for (long long i = 0; i < 18; i++)
    for (long long j = 0; j <= i; j++)
      for (long long k = 0; k < M; k++)
        f[i][k] = (f[i][k] + cnt[j][k] * cnt[i - j][k]) % MOD;
  for (long long i = 0; i < 18; i++) fwt_xor(f[i], M, -1);
  for (long long i = 0; i < M; i++) a[i] = f[bit[i]][i];
  fwt_xor(c, M, 1);
  for (long long i = 0; i < M; i++) c[i] = c[i] * c[i] % MOD;
  fwt_xor(c, M, -1);
  fb[1] = 1;
  for (long long i = 2; i < M; i++) fb[i] = (fb[i - 1] + fb[i - 2]) % MOD;
  for (long long i = 0; i < M; i++) {
    a[i] = a[i] * fb[i] % MOD;
    b[i] = b[i] * fb[i] % MOD;
    c[i] = c[i] * fb[i] % MOD;
  }
  fwt_and(a, M, 1);
  fwt_and(b, M, 1);
  fwt_and(c, M, 1);
  for (long long i = 0; i < M; i++) a[i] = a[i] * b[i] % MOD * c[i] % MOD;
  fwt_and(a, M, -1);
  for (long long i = 0; i < 17; i++) ans = (ans + a[1 << i]) % MOD;
  printf("%lld\n", ans);
}