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 long long mod = 1e9 + 7, N = 150005;
const double pi = acos(-1.0);
long long n, ans, X, m, inv2, f[N];
long long g[N];
inline long long ksm(long long x, long long y) {
  long long ans = 1;
  for (; y; y /= 2, x = (long long)x * x % mod)
    if (y & 1) ans = (long long)ans * x % mod;
  return ans;
}
inline void read(long long &x) {
  char c = getchar();
  x = 0;
  while (c > '9' || c < '0') c = getchar();
  while (c >= '0' && c <= '9') {
    x = x * 10 + c - '0';
    c = getchar();
  }
}
struct poly {
  long long a[N], len;
  void dwt(long long opt) {
    for (long long d = 1; d < len; d *= 2)
      for (long long i = 0; i < len; i += d * 2)
        for (long long j = i; j < i + d; j++) {
          long long x = a[j], y = a[j + d];
          if (opt == 0) {
            a[j] = (x + y) % mod;
            a[j + d] = (x - y + mod) % mod;
          }
          if (opt == 1) a[j] = (x + y) % mod;
          if (opt == 2) a[j + d] = (x + y) % mod;
        }
  }
  void idwt(long long opt) {
    for (long long d = 1; d < len; d *= 2)
      for (long long i = 0; i < len; i += d * 2)
        for (long long j = i; j < i + d; j++) {
          long long x = a[j], y = a[j + d];
          if (opt == 0) {
            a[j] = (long long)(x + y) % mod * inv2 % mod;
            a[j + d] = (long long)(x - y + mod) % mod * inv2 % mod;
          }
          if (opt == 1) a[j] = (x + mod - y) % mod;
          if (opt == 2) a[j + d] = (x + mod - y) % mod;
        }
  }
  poly fwt(const poly &b, const long long &z) {
    poly x = *this, y = b;
    x.dwt(z);
    y.dwt(z);
    for (long long i = 0; i < len; ++i)
      x.a[i] = (long long)x.a[i] * y.a[i] % mod;
    x.idwt(z);
    return x;
  }
} a, c, d;
signed main() {
  m = 1 << 17;
  inv2 = ksm(2, mod - 2);
  read(n);
  for (long long i = 1; i <= n; ++i) {
    read(X);
    ++a.a[X];
  }
  a.len = m;
  f[0] = 0;
  f[1] = 1;
  for (long long i = 2; i < m; ++i) f[i] = (f[i - 1] + f[i - 2]) % mod;
  for (long long i = 0; i < m; ++i) {
    for (long long j = i;; j = (j - 1) & i) {
      g[i] += a.a[j] * a.a[i ^ j];
      if (j == 0) break;
    }
    g[i] %= mod;
  }
  for (long long i = 0; i < m; ++i) c.a[i] = g[i] * f[i] % mod;
  c.len = m;
  d = a.fwt(a, 0);
  for (long long i = 0; i < m; ++i) d.a[i] = (long long)d.a[i] * f[i] % mod;
  for (long long i = 0; i < m; ++i) a.a[i] = (long long)a.a[i] * f[i] % mod;
  a = a.fwt(c, 1);
  a = a.fwt(d, 1);
  for (long long i = 1; i < m; i *= 2) (ans += a.a[i]) %= mod;
  cout << ans;
}