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 T>
inline bool cmin(T& a, const T& b) {
  return a > b ? a = b, 1 : 0;
}
template <typename T>
inline bool cmax(T& a, const T& b) {
  return a < b ? a = b, 1 : 0;
}
int read() {
  int x = 0, f = 1;
  char ch;
  for (ch = getchar(); !isdigit(ch); ch = getchar())
    if (ch == '-') f = -1;
  for (; isdigit(ch); x = x * 10 + ch - '0', ch = getchar())
    ;
  return x * f;
}
const int MaxN = 1 << 17, MaxM = 1001234, P = 1e9 + 7;
int n, u, a[MaxN], b[MaxN], c[MaxN], d[MaxN], fib[MaxN];
void xor_conv(int x[], int z[]) {
  for (int i = 0; i < u; i++) z[i] = x[i];
  for (int i = 0; i < n; i++)
    for (int j = 0; j < u; j++)
      if (j >> i & 1) {
        int l = z[j ^ (1 << i)], r = z[j];
        z[j] = (l - r + P) % P;
        z[j ^ (1 << i)] = (l + r) % P;
      }
  for (int i = 0; i < u; i++) z[i] = (long long)z[i] * z[i] % P;
  int inv = P + 1 >> 1;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < u; j++)
      if (j >> i & 1) {
        int l = z[j ^ (1 << i)], r = z[j];
        z[j] = (long long)(l - r + P) * inv % P;
        z[j ^ (1 << i)] = (long long)(l + r) * inv % P;
      }
}
int t[MaxN];
void fmt(int x[]) {
  for (int i = 0; i < u; i++) t[i] = x[u - 1 ^ i];
  for (int i = 0; i < n; i++)
    for (int j = 0; j < u; j++)
      if (j >> i & 1) t[j] = (t[j] + t[j ^ (1 << i)]) % P;
  for (int i = 0; i < u; i++) x[i] = t[i];
}
void ifmt(int x[]) {
  for (int i = 0; i < n; i++)
    for (int j = 0; j < u; j++)
      if (j >> i & 1) x[j] = (x[j] - x[j ^ (1 << i)] + P) % P;
}
void and_conv(int x[], int y[], int z[], int w[]) {
  fmt(x);
  fmt(y);
  fmt(z);
  for (int i = 0; i < u; i++) w[i] = (long long)x[i] * y[i] % P * z[i] % P;
  ifmt(w);
}
int main() {
  n = read();
  fib[0] = 0;
  fib[1] = 1;
  for (int i = 2; i < MaxN; i++) fib[i] = (fib[i - 1] + fib[i - 2]) % P;
  for (int i = 1; i <= n; i++) a[read()]++;
  n = 17;
  u = 1 << n;
  for (int i = 0; i < u; i++) {
    b[i] = (b[i] + (long long)a[0] * a[i]) % P;
    for (int j = i; j; j = j - 1 & i)
      b[i] = (b[i] + (long long)a[j] * a[i - j]) % P;
  }
  xor_conv(a, c);
  for (int i = 0; i < u; i++)
    a[i] = (long long)a[i] * fib[i] % P, b[i] = (long long)b[i] * fib[i] % P,
    c[i] = (long long)c[i] * fib[i] % P;
  and_conv(a, b, c, d);
  int ans = 0;
  for (int i = 1; i < u; i <<= 1) ans = (ans + d[i ^ u - 1]) % P;
  cout << ans << endl;
  return 0;
}