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 int N = 200050, mo = 1e9 + 7, ni = 5e8 + 4;
int num[N], f[20][N], p[20][N], g[N], m = 1 << 17, a[1000050], b[N], c[N];
int fab[N];
void fwt_xor(int *v) {
  int x, y;
  for (int i = 1; i < m; i <<= 1)
    for (int j = 0; j < m; j += i << 1)
      for (int k = 0; k < i; ++k) {
        x = v[j + k], y = v[j + k + i];
        v[j + k] = (x + y) % mo, v[j + k + i] = (mo + x - y) % mo;
      }
  return;
}
void ufwt_xor(int *v) {
  int x, y;
  for (int i = 1; i < m; i <<= 1)
    for (int j = 0; j < m; j += i << 1)
      for (int k = 0; k < i; ++k) {
        x = v[j + k], y = v[j + k + i];
        v[j + k] = 1ll * (x + y) * ni % mo,
              v[j + k + i] = 1ll * (mo + x - y) * ni % mo;
      }
  return;
}
void fwt_or(int *v) {
  for (int i = 1; i < m; i <<= 1)
    for (int j = 0; j < m; j += i << 1)
      for (int k = 0; k < i; ++k) (v[j + k + i] += v[j + k]) %= mo;
  return;
}
void ufwt_or(int *v) {
  for (int i = 1; i < m; i <<= 1)
    for (int j = 0; j < m; j += i << 1)
      for (int k = 0; k < i; ++k)
        v[j + k + i] = (mo + v[j + k + i] - v[j + k]) % mo;
  return;
}
void fwt_and(int *v) {
  for (int i = 1; i < m; i <<= 1)
    for (int j = 0; j < m; j += i << 1)
      for (int k = 0; k < i; ++k) (v[j + k] += v[j + k + i]) %= mo;
  return;
}
void ufwt_and(int *v) {
  for (int i = 1; i < m; i <<= 1)
    for (int j = 0; j < m; j += i << 1)
      for (int k = 0; k < i; ++k)
        v[j + k] = (mo + v[j + k] - v[j + k + i]) % mo;
  return;
}
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; ++i) scanf("%d", &a[i]);
  for (int i = 1; i <= m; ++i) num[i] = num[i >> 1] + (i & 1);
  for (int i = 1; i <= n; ++i) ++f[num[a[i]]][a[i]];
  for (int i = 0; i <= 17; ++i) fwt_or(f[i]);
  for (int i = 0; i <= 17; ++i)
    for (int j = 0; i + j <= 17; ++j)
      for (int k = 0; k < m; ++k)
        (p[i + j][k] += 1ll * f[i][k] * f[j][k] % mo) %= mo;
  for (int i = 0; i <= 17; ++i) ufwt_or(p[i]);
  fab[1] = 1;
  for (int i = 2; i < m; ++i) fab[i] = (fab[i - 2] + fab[i - 1]) % mo;
  for (int i = 0; i <= 17; ++i)
    for (int j = 0; j < m; ++j)
      if (num[j] == i) (g[j] += p[i][j]) %= mo;
  for (int i = 1; i <= n; ++i) ++b[a[i]], ++c[a[i]];
  fwt_xor(b);
  for (int i = 0; i < m; ++i) b[i] = 1ll * b[i] * b[i] % mo;
  ufwt_xor(b);
  for (int i = 0; i < m; ++i) {
    b[i] = 1ll * b[i] * fab[i] % mo;
    c[i] = 1ll * c[i] * fab[i] % mo;
    g[i] = 1ll * g[i] * fab[i] % mo;
  }
  fwt_and(b), fwt_and(c), fwt_and(g);
  for (int i = 0; i < m; ++i) b[i] = 1ll * b[i] * c[i] % mo * g[i] % mo;
  ufwt_and(b);
  int ans = 0;
  for (int i = 1; i < m; i <<= 1) (ans += b[i]) %= mo;
  cout << ans;
  return 0;
}