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;
inline int getInt() {
  int res(0);
  char c = getchar();
  while (c < '0') c = getchar();
  while (c >= '0') {
    res = res * 10 + (c - '0');
    c = getchar();
  }
  return res;
}
inline int fastpo(int x, int n, int mod) {
  int res(1);
  while (n) {
    if (n & 1) {
      res = res * (long long)x % mod;
    }
    x = x * (long long)x % mod;
    n /= 2;
  }
  return res;
}
const int N = 1 << 17;
const int LOG = 17;
const int mod = 1e9 + 7;
const int inf = 1e9 + 7;
const int inv2 = inf / 2 + 1;
int a[N], b[N], s[N], t[N], f[N];
int main() {
  int n;
  n = getInt();
  for (int i(1); i <= n; i++) {
    int x = getInt();
    a[x]++;
  }
  for (int i(0); i < (1 << LOG); i++) {
    for (int j(i); j; j = (j - 1) & i)
      b[i] = (b[i] + (long long)a[j] * a[i - j]) % mod;
    b[i] = (b[i] + (long long)a[0] * a[i]) % mod;
  }
  memcpy(s, a, sizeof(a));
  for (int i(0); i < LOG; i++)
    for (int j(0); j < (1 << LOG); j++)
      if (j & (1 << i)) {
        s[j - (1 << i)] += s[j];
        s[j] = s[j - (1 << i)] - 2 * s[j];
      }
  for (int i(0); i < (1 << LOG); i++) s[i] = (s[i] * (long long)s[i]) % mod;
  for (int i(0); i < LOG; i++)
    for (int j(0); j < (1 << LOG); j++)
      if ((j & (1 << i))) {
        s[j - (1 << i)] = (s[j - (1 << i)] + s[j]) * (long long)inv2 % mod;
        s[j] = (s[j - (1 << i)] - s[j] + mod) % mod;
      }
  for (int i(0); i < (1 << LOG); i++) {
  }
  f[0] = 0;
  f[1] = 1;
  for (int i(2); i < (1 << LOG); i++) {
    f[i] = (f[i - 1] + f[i - 2]) % mod;
  }
  for (int i(0); i < (1 << LOG); i++) {
    a[i] = (long long)a[i] * f[i] % mod;
    b[i] = (long long)b[i] * f[i] % mod;
    s[i] = (long long)s[i] * f[i] % mod;
  }
  for (int i(0); i < LOG; i++)
    for (int j(0); j < (1 << LOG); j++)
      if (!(j & (1 << i)))
        if ((a[j] += a[j + (1 << i)]) >= mod) a[j] -= mod;
  for (int i(0); i < LOG; i++)
    for (int j(0); j < (1 << LOG); j++)
      if (!(j & (1 << i)))
        if ((b[j] += b[j + (1 << i)]) >= mod) b[j] -= mod;
  for (int i(0); i < LOG; i++)
    for (int j(0); j < (1 << LOG); j++)
      if (!(j & (1 << i)))
        if ((s[j] += s[j + (1 << i)]) >= mod) s[j] -= mod;
  for (int i(0); i < (1 << LOG); i++)
    a[i] = ((long long)a[i] * b[i] % mod * s[i]) % mod;
  for (int i(0); i < LOG; i++)
    for (int j(0); j < (1 << LOG); j++)
      if (!(j & (1 << i)))
        if ((a[j] -= a[j + (1 << i)]) < 0) a[j] += mod;
  int ans = 0;
  for (int i(0); i < LOG; i++) ans = (ans + a[1 << i]) % mod;
  cout << ans << endl;
}