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 mod = 1000000007LL;
long long a[1 << 17], b[1 << 17], c[1 << 17], fib[1 << 17 | 3] = {0, 1};
int n;
void trans1(long long* x, int len = 17) {
  if (!len) return;
  trans1(x, len - 1);
  trans1(x + (1 << (len - 1)), len - 1);
  for (int i = 0; i < (1 << (len - 1)); ++i) {
    long long a = x[i], b = x[i + (1 << (len - 1))];
    x[i] = (a + b) % mod;
    x[i + (1 << (len - 1))] = (a - b + mod) % mod;
  }
}
void inv_trans1(long long* x, int len = 17) {
  if (!len) return;
  for (int i = 0; i < (1 << (len - 1)); ++i) {
    long long a = x[i], b = x[i + (1 << (len - 1))];
    x[i] = (a + b) % mod;
    x[i + (1 << (len - 1))] = (a - b + mod) % mod;
  }
  inv_trans1(x, len - 1);
  inv_trans1(x + (1 << (len - 1)), len - 1);
}
void trans2(long long* x, int len = 17) {
  if (!len) return;
  trans2(x, len - 1);
  trans2(x + (1 << (len - 1)), len - 1);
  for (int i = 0; i < (1 << (len - 1)); ++i)
    (x[i + (1 << (len - 1))] += x[i]) %= mod;
}
void inv_trans2(long long* x, int len = 17) {
  if (!len) return;
  for (int i = 0; i < (1 << (len - 1)); ++i)
    (x[i + (1 << (len - 1))] += mod - x[i]) %= mod;
  inv_trans2(x, len - 1);
  inv_trans2(x + (1 << (len - 1)), len - 1);
}
void trans3(long long* x, int len = 17) {
  if (!len) return;
  trans3(x, len - 1);
  trans3(x + (1 << (len - 1)), len - 1);
  for (int i = 0; i < (1 << (len - 1)); ++i)
    (x[i] += x[i + (1 << (len - 1))]) %= mod;
}
void inv_trans3(long long* x, int len = 17) {
  if (!len) return;
  for (int i = 0; i < (1 << (len - 1)); ++i)
    (x[i] += mod - x[i + (1 << (len - 1))]) %= mod;
  inv_trans3(x, len - 1);
  inv_trans3(x + (1 << (len - 1)), len - 1);
}
void get_c() {
  int brush = (1 << 17) - 1, x, y;
  for (x = 0; x <= brush; ++x) {
    if (!a[x]) continue;
    y = brush ^ x;
    for (int z = y; z; z = (z - 1) & y)
      if (a[z]) (c[x | z] += a[x] * a[z]) %= mod;
    (c[x] += a[x] * a[0]) %= mod;
  }
}
int main() {
  for (int i = 2; i < (1 << 17); ++i) fib[i] = (fib[i - 1] + fib[i - 2]) % mod;
  scanf("%d", &n);
  while (n--) {
    int x;
    scanf("%d", &x);
    ++a[x];
  }
  memcpy(b, a, sizeof(b));
  trans1(b);
  for (int i = 0; i < (1 << 17); ++i) (b[i] *= b[i]) %= mod;
  inv_trans1(b);
  long long inv2 = 1LL;
  for (int i = 0; i < 17; ++i) (inv2 *= 500000004LL) %= mod;
  for (int i = 0; i < (1 << 17); ++i) (b[i] *= inv2) %= mod;
  get_c();
  for (int i = 0; i < (1 << 17); ++i) (a[i] *= fib[i]) %= mod;
  for (int i = 0; i < (1 << 17); ++i) (b[i] *= fib[i]) %= mod;
  for (int i = 0; i < (1 << 17); ++i) (c[i] *= fib[i]) %= mod;
  trans3(a);
  trans3(b);
  trans3(c);
  for (int i = 0; i < (1 << 17); ++i) {
    (a[i] *= b[i]) %= mod;
    (a[i] *= c[i]) %= mod;
  }
  inv_trans3(a);
  long long ans = 0;
  for (int i = 0; i < 17; ++i) ans += a[1 << i];
  ans %= mod;
  printf("%I64d\n", ans);
  return 0;
}