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;
int a14;
inline int rd(int l, int r) { return rand() % (r - l + 1) + l; }
const int mxn = 1 << 17, mod = 1e9 + 7, V2 = (mod + 1) / 2;
int n, b[mxn];
long long d0[18][mxn], d1[mxn], d2[mxn], d3[mxn], fb[mxn];
int cb(int x) {
  int re = 0;
  while (x) ++re, x -= x & -x;
  return re;
}
void AND(long long a[], int tp = 1) {
  for (int d = 1; d < n; d *= 2)
    for (int i = 0; i < n; i += d * 2)
      for (int j = 0; j < d; ++j) {
        if (tp)
          (a[i + j] += a[i + j + d]) %= mod;
        else
          (a[i + j] -= a[i + j + d]) %= mod;
      }
}
void OR(long long a[], int tp = 1) {
  for (int d = 1; d < n; d *= 2)
    for (int i = 0; i < n; i += d * 2)
      for (int j = 0; j < d; ++j) {
        if (tp)
          (a[i + j + d] += a[i + j]) %= mod;
        else
          (a[i + j + d] -= a[i + j]) %= mod;
      }
}
void XOR(long long a[], int tp = 1) {
  for (int d = 1; d < n; d *= 2)
    for (int i = 0; i < n; i += d * 2)
      for (int j = 0; j < d; ++j) {
        long long t = a[i + j + d];
        a[i + j + d] = (a[i + j] - t) % mod, a[i + j] = (a[i + j] + t) % mod;
        if (!tp)
          a[i + j + d] = a[i + j + d] * V2 % mod,
                    a[i + j] = a[i + j] * V2 % mod;
      }
}
void JJ() {
  for (int i = 0; i < n; ++i) d0[cb(i)][i] = b[i];
  for (int i = 0; i < 18; ++i) OR(d0[i]);
  for (int k = 17; ~k; --k) {
    for (int i = 0; i < n; ++i)
      d0[k][i] = (k ? 2 : 1) * d0[k][i] * d0[0][i] % mod;
    for (int j = 1; j < k; ++j)
      for (int i = 0; i < n; ++i) (d0[k][i] += d0[j][i] * d0[k - j][i]) %= mod;
    OR(d0[k], 0);
  }
  for (int i = 0; i < n; ++i) d1[i] = d0[cb(i)][i];
}
int main() {
  a14 = scanf("%d", &n);
  for (int i = 1, x; i <= n; ++i) a14 = scanf("%d", &x), ++b[x];
  n = 1 << 17;
  JJ();
  for (int i = 0; i < n; ++i) d2[i] = d3[i] = b[i];
  XOR(d2);
  for (int i = 0; i < n; ++i) d2[i] = d2[i] * d2[i] % mod;
  XOR(d2, 0);
  fb[1] = 1;
  for (int i = 2; i < n; ++i) fb[i] = (fb[i - 1] + fb[i - 2]) % mod;
  for (int i = 0; i < n; ++i)
    d1[i] = d1[i] * fb[i] % mod, d2[i] = d2[i] * fb[i] % mod,
    d3[i] = d3[i] * fb[i] % mod;
  AND(d1), AND(d2), AND(d3);
  for (int i = 0; i < n; ++i) d1[i] = d1[i] * d2[i] % mod * d3[i] % mod;
  AND(d1, 0);
  long long ans = 0;
  for (int i = 1; i < n; i *= 2) ans += d1[i];
  ans = (ans % mod + mod) % mod;
  printf("%lld\n", ans);
  return 0;
}