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;
template <typename Tp>
void read(Tp &x) {
  x = 0;
  int op = 1;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') op = -1;
    ch = getchar();
  }
  while (isdigit(ch)) {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  x *= op;
}
template <typename Tp>
void CMax(Tp &x, Tp y) {
  if (y > x) x = y;
}
template <typename Tp>
void CMin(Tp &x, Tp y) {
  if (y < x) x = y;
}
const int N = (1 << 17) + 10;
const int MOD = 1e9 + 7;
int Pls(int x, int y) {
  x += y;
  if (x >= MOD) x -= MOD;
  return x;
}
int Sub(int x, int y) {
  x -= y;
  if (x < 0) x += MOD;
  return x;
}
namespace Poly {
void FWTor(vector<int> &f, int tp) {
  int n = (int)f.size();
  for (int l = 2, m = 1; l <= n; l <<= 1, m <<= 1) {
    for (int i = 0; i < n; i += l)
      for (int j = 0; j < m; ++j) {
        if (tp == 1)
          f[i + j + m] = Pls(f[i + j + m], f[i + j]);
        else
          f[i + j + m] = Sub(f[i + j + m], f[i + j]);
      }
  }
}
void FWTand(vector<int> &f, int tp) {
  int n = (int)f.size();
  for (int l = 2, m = 1; l <= n; l <<= 1, m <<= 1) {
    for (int i = 0; i < n; i += l)
      for (int j = 0; j < m; ++j) {
        if (tp == 1)
          f[i + j] = Pls(f[i + j], f[i + j + m]);
        else
          f[i + j] = Sub(f[i + j], f[i + j + m]);
      }
  }
}
int inv2 = (MOD + 1) >> 1;
void FWTxor(vector<int> &f, int tp) {
  int n = (int)f.size();
  for (int l = 2, m = 1; l <= n; l <<= 1, m <<= 1) {
    for (int i = 0; i < n; i += l)
      for (int j = 0; j < m; ++j) {
        int x = f[i + j], y = f[i + j + m];
        if (tp == 1)
          f[i + j] = Pls(x, y), f[i + j + m] = Sub(x, y);
        else
          f[i + j] = 1ll * Pls(x, y) * inv2 % MOD,
                f[i + j + m] = 1ll * Sub(x, y) * inv2 % MOD;
      }
  }
}
vector<int> mulOR(vector<int> f, vector<int> g) {
  int n = (int)f.size();
  FWTor(f, 1);
  FWTor(g, 1);
  for (int i = 0; i < n; ++i) f[i] = 1ll * f[i] * g[i] % MOD;
  FWTor(f, -1);
  return f;
}
vector<int> mulAND(vector<int> f, vector<int> g) {
  int n = (int)f.size();
  FWTand(f, 1);
  FWTand(g, 1);
  for (int i = 0; i < n; ++i) f[i] = 1ll * f[i] * g[i] % MOD;
  FWTand(f, -1);
  return f;
}
vector<int> mulXOR(vector<int> f, vector<int> g) {
  int n = (int)f.size();
  FWTxor(f, 1);
  FWTxor(g, 1);
  for (int i = 0; i < n; ++i) f[i] = 1ll * f[i] * g[i] % MOD;
  FWTxor(f, -1);
  return f;
}
vector<int> a[18], b[18], c[18];
int ppc[N], lg[N];
void process(int n) {
  for (int i = 1; i <= n; ++i) ppc[i] = ppc[i - (i & -i)] + 1;
  for (int i = 2; i <= n; ++i) lg[i] = lg[i >> 1] + 1;
}
vector<int> mulSub(vector<int> f, vector<int> g) {
  int n = (int)f.size();
  int d = lg[n];
  for (int i = (0); i <= (d); ++i)
    a[i].resize(n), b[i].resize(n), c[i].resize(n);
  for (int i = 0; i < n; ++i) a[ppc[i]][i] = f[i];
  for (int i = 0; i < n; ++i) b[ppc[i]][i] = g[i];
  for (int i = (0); i <= (d); ++i) FWTor(a[i], 1), FWTor(b[i], 1);
  for (int i = (0); i <= (d); ++i)
    for (int j = (0); j <= (d); ++j) {
      if (i + j > d) break;
      for (int k = 0; k < n; ++k)
        c[i + j][k] = Pls(c[i + j][k], 1ll * a[i][k] * b[j][k] % MOD);
    }
  for (int i = (0); i <= (d); ++i) FWTor(c[i], -1);
  for (int i = 0; i < n; ++i) f[i] = c[ppc[i]][i];
  return f;
}
}  // namespace Poly
int n, lim, s;
vector<int> A, B, C;
int fib[N];
int main() {
  read(n);
  lim = (1 << 17);
  C.resize(lim);
  for (int i = (1); i <= (n); ++i) read(s), C[s]++;
  fib[0] = 0;
  fib[1] = 1;
  for (int i = (2); i <= (lim); ++i) fib[i] = Pls(fib[i - 1], fib[i - 2]);
  Poly::process(lim);
  A = Poly::mulSub(C, C);
  B = Poly::mulXOR(C, C);
  for (int i = 0; i < lim; ++i) {
    A[i] = 1ll * A[i] * fib[i] % MOD;
    B[i] = 1ll * B[i] * fib[i] % MOD;
    C[i] = 1ll * C[i] * fib[i] % MOD;
  }
  A = Poly::mulAND(A, Poly::mulAND(B, C));
  int ans = 0;
  for (int l = 1; l < lim; l <<= 1) ans = Pls(ans, A[l]);
  printf("%d", ans);
  return 0;
}