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 num = 0, flag = 1;
  char c;
  while ((c = getchar()) < '0' || c > '9')
    if (c == '-') flag = -1;
  while (c >= '0' && c <= '9') num = num * 10 + c - 48, c = getchar();
  return num * flag;
}
int n, len = 1 << 17, ans;
int a[1000005], b[1000005], c[1000005], d[18][1000005], e[18][1000005],
    f[1000005], cnt[1000005], s[1000005];
inline int upd(int x) { return x < 1000000007 ? x : x - 1000000007; }
inline void FWT_and(int *a, int len, int op) {
  for (int i = 1; i < len; i <<= 1)
    for (int j = 0; j < len; j += (i << 1))
      for (int k = 0; k < i; k++)
        if (~op)
          a[j + k] = upd(a[j + k] + a[i + j + k]);
        else
          a[j + k] = upd(a[j + k] + 1000000007 - a[i + j + k]);
}
inline void FWT_or(int *a, int len, int op) {
  for (int i = 1; i < len; i <<= 1)
    for (int j = 0; j < len; j += (i << 1))
      for (int k = 0; k < i; k++)
        if (~op)
          a[i + j + k] = upd(a[j + k] + a[i + j + k]);
        else
          a[i + j + k] = upd(a[i + j + k] + 1000000007 - a[j + k]);
}
inline void FWT_xor(int *a, int len, int op) {
  for (int i = 1; i < len; i <<= 1)
    for (int j = 0; j < len; j += (i << 1))
      for (int k = 0; k < i; k++) {
        int x = a[j + k], y = a[i + j + k];
        a[j + k] = upd(x + y), a[i + j + k] = upd(x + 1000000007 - y);
        if (!~op)
          a[j + k] = 1ll * a[j + k] * 500000004 % 1000000007,
                a[i + j + k] = 1ll * a[i + j + k] * 500000004 % 1000000007;
      }
}
int main() {
  n = getint();
  for (int i = 1; i <= n; i++) s[getint()]++;
  for (int i = 1; i < len; i++) cnt[i] = cnt[i >> 1] + (i & 1);
  f[1] = 1;
  for (int i = 2; i < len; i++) f[i] = upd(f[i - 1] + f[i - 2]);
  for (int i = 0; i < len; i++) d[cnt[i]][i] = s[i];
  for (int i = 0; i <= 17; i++) FWT_or(d[i], len, 1);
  for (int i = 0; i <= 17; i++)
    for (int j = 0; j <= i; j++)
      for (int k = 0; k < len; k++)
        e[i][k] = upd(e[i][k] + 1ll * d[j][k] * d[i - j][k] % 1000000007);
  for (int i = 0; i <= 17; i++) FWT_or(e[i], len, -1);
  for (int i = 0; i < len; i++) a[i] = 1ll * f[i] * e[cnt[i]][i] % 1000000007;
  for (int i = 0; i < len; i++) b[i] = 1ll * s[i] * f[i] % 1000000007;
  FWT_xor(s, len, 1);
  for (int i = 0; i < len; i++) c[i] = 1ll * s[i] * s[i] % 1000000007;
  FWT_xor(c, len, -1);
  for (int i = 0; i < len; i++) c[i] = 1ll * c[i] * f[i] % 1000000007;
  FWT_and(a, len, 1), FWT_and(b, len, 1), FWT_and(c, len, 1);
  for (int i = 0; i < len; i++)
    a[i] = 1ll * a[i] * b[i] % 1000000007 * c[i] % 1000000007;
  FWT_and(a, len, -1);
  for (int i = 0; i < 17; i++) ans = upd(ans + a[1 << i]);
  printf("%d\n", ans);
}