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;
struct pat {
  int x, y;
  pat(int x = 0, int y = 0) : x(x), y(y) {}
  bool operator<(const pat &p) const { return x == p.x ? y < p.y : x < p.x; }
};
template <typename TP>
inline void read(TP &tar) {
  TP ret = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    ret = ret * 10 + (ch - '0');
    ch = getchar();
  }
  tar = ret * f;
}
namespace RKK {
const int N = 18, S = 1 << 17;
const int mo = 1000000007, inv2 = 500000004;
int bcnt(int x) { return __builtin_popcount(x); }
int lbit(int x) { return __builtin_ffs(x); }
int add(int a, const int &b) {
  a += b;
  if (a >= mo)
    a -= mo;
  else if (a < 0)
    a += mo;
  return a;
}
void doadd(int &a, const int &b) {
  a += b;
  if (a >= mo)
    a -= mo;
  else if (a < 0)
    a += mo;
}
void fwtand(int *a, int len, int tp) {
  for (int i = 1; i < len; i <<= 1)
    for (int j = 0; j < len; j += i << 1)
      for (int k = 0; k < i; k++) doadd(a[j + k], tp * a[j + k + i]);
}
void fwtor(int *a, int len, int tp) {
  for (int i = 1; i < len; i <<= 1)
    for (int j = 0; j < len; j += i << 1)
      for (int k = 0; k < i; k++) doadd(a[j + k + i], tp * a[j + k]);
}
void fwtxor(int *a, int len, int tp) {
  int x, y;
  for (int i = 1; i < len; i <<= 1)
    for (int j = 0; j < len; j += i << 1)
      for (int k = 0; k < i; k++) {
        x = a[j + k], y = a[j + k + i];
        a[j + k] = add(x, y), a[j + k + i] = add(x, -y);
        if (tp == -1)
          a[j + k] = (long long)a[j + k] * inv2 % mo,
                a[j + k + i] = (long long)a[j + k + i] * inv2 % mo;
      }
}
int n, mxlen = 1, mxlog, mxa, bc[S];
int f[N][S], g[S];
int a[S], b[S], c[S], fib[S];
int main() {
  fib[0] = 0, fib[1] = 1;
  for (int i = 2; i < S; i++) fib[i] = add(fib[i - 1], fib[i - 2]);
  for (int i = 1; i < S; i++) bc[i] = bcnt(i);
  read(n);
  for (int i = 1, w; i <= n; i++)
    read(w), mxa = max(mxa, w), f[bc[w]][w]++, a[w]++, doadd(b[w], fib[w]);
  while (mxlen <= mxa) mxlen <<= 1, mxlog++;
  for (int i = 0; i <= mxlog; i++) fwtor(f[i], mxlen, 1);
  for (int i = 0; i <= mxlog; i++) {
    memset(g, 0, mxlen * 4);
    for (int j = 0; j <= i; j++)
      for (int s = 0; s < mxlen; s++)
        doadd(g[s], 1ll * f[j][s] * f[i - j][s] % mo);
    fwtor(g, mxlen, -1);
    for (int s = 0; s < mxlen; s++)
      if (bc[s] == i) doadd(c[s], g[s]);
  }
  fwtxor(a, mxlen, 1);
  for (int i = 0; i < mxlen; i++) a[i] = 1ll * a[i] * a[i] % mo;
  fwtxor(a, mxlen, -1);
  for (int i = 0; i < mxlen; i++) a[i] = 1ll * a[i] * fib[i] % mo;
  for (int i = 0; i < mxlen; i++) c[i] = 1ll * c[i] * fib[i] % mo;
  fwtand(a, mxlen, 1), fwtand(b, mxlen, 1), fwtand(c, mxlen, 1);
  for (int i = 0; i < mxlen; i++) c[i] = 1ll * a[i] * b[i] % mo * c[i] % mo;
  fwtand(c, mxlen, -1);
  int ans = 0;
  for (int i = 1; i < mxlen; i <<= 1) doadd(ans, c[i]);
  printf("%d\n", ans);
  return 0;
}
}  // namespace RKK
int main() { return RKK::main(); }