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 = 1 << 17;
long long f1[20][1 << 18], f2[20][1 << 18];
int n, x, ans = 0, fib[1 << 18], siz[1 << 18];
long long a[1 << 18], b[1 << 18], c[1 << 18];
void FWT(long long a[], int type, int fwt) {
  for (int i = 1; i < N; i <<= 1)
    for (int j = 0; j < N; j += i << 1)
      for (int k = j; k < i + j; k++) {
        long long x = a[k], y = a[k + i];
        if (fwt == 1) {
          if (type == 0) a[k + i] = (x + y) % 1000000007LL;
          if (type == 1) a[k] = (x + y) % 1000000007LL;
          if (type == 2)
            a[k] = (x + y) % 1000000007LL,
            a[k + i] = (x + 1000000007LL - y) % 1000000007LL;
        } else {
          if (type == 0) a[k + i] = (y + 1000000007LL - x) % 1000000007LL;
          if (type == 1) a[k] = (x + 1000000007LL - y) % 1000000007LL;
          if (type == 2)
            a[k] = (x + y) * 500000004LL % 1000000007LL,
            a[k + i] = (x + 1000000007LL - y) * 500000004LL % 1000000007LL;
        }
      }
}
void solve() {
  for (int i = 0; i < 18; i++) FWT(f1[i], 0, 1);
  for (int i = 0; i < 18; i++)
    for (int j = 0; j <= i; j++)
      for (int k = 0; k < N; k++)
        (f2[i][k] += f1[j][k] * f1[i - j][k]) %= 1000000007LL;
  for (int i = 0; i < 18; i++) FWT(f2[i], 0, -1);
  for (int i = 0; i < N; i++) (a[i] += f2[siz[i]][i]) %= 1000000007LL;
}
int main() {
  scanf("%d", &n);
  fib[1] = 1;
  for (int i = 2; i < N; i++) fib[i] = (fib[i - 1] + fib[i - 2]) % 1000000007LL;
  for (int i = 0; i < N; i++)
    for (int j = 0; j < 18; j++)
      if ((i >> j) & 1) siz[i]++;
  for (int i = 0; i < n; i++) {
    scanf("%d", &x);
    b[x]++, c[x]++, f1[siz[x]][x]++;
  }
  solve();
  FWT(c, 2, 1);
  for (int i = 0; i < N; i++) (c[i] *= c[i]) %= 1000000007LL;
  FWT(c, 2, -1);
  for (int i = 0; i < N; i++) (a[i] *= fib[i]) %= 1000000007LL;
  for (int i = 0; i < N; i++) (b[i] *= fib[i]) %= 1000000007LL;
  for (int i = 0; i < N; i++) (c[i] *= fib[i]) %= 1000000007LL;
  FWT(a, 1, 1), FWT(b, 1, 1), FWT(c, 1, 1);
  for (int i = 0; i < N; i++)
    a[i] = a[i] * b[i] % 1000000007LL * c[i] % 1000000007LL;
  FWT(a, 1, -1);
  for (int i = 0; i < 18; i++) (ans += a[1 << i]) %= 1000000007LL;
  printf("%d", ans);
}