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;
const int MX = 1e9 + 7;
const int INF = 1e9 + 9;
int n;
long long int s[N + 9];
long long int fib[N + 9];
long long int A[N + 9], B[N + 9], C[N + 9];
long long int fast(long long int a, long long int b) {
  if (!b) return 1;
  long long int x = fast(a, b / 2);
  if (b & 1) return (((1LL * x * x) % MX) * a) % MX;
  return (1LL * x * x) % MX;
}
void fwh(bool inv) {
  for (int i = 0; i < 17; ++i)
    for (int j = 0; j < N; j += (1 << (i + 1))) {
      for (int k = 0; k < (1 << i); ++k) {
        C[j + k] = (C[j + k] + C[j + k + (1 << i)]) % MX;
        C[j + k + (1 << i)] = (C[j + k] - 2 * C[j + k + (1 << i)]) % MX;
      }
    }
  if (inv) {
    long long int rev = fast(N, MX - 2);
    for (int i = 0; i < N; ++i) C[i] = (1LL * C[i] * rev) % MX;
  }
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) {
    int a;
    scanf("%d", &a);
    s[a]++;
  }
  fib[0] = 0, fib[1] = 1;
  for (int i = 2; i < N; ++i) fib[i] = (fib[i - 1] + fib[i - 2]) % MX;
  for (int i = 0; i < N; ++i) B[i] = C[i] = s[i];
  for (int i = 0; i < N; ++i) {
    int cur = i ^ (N - 1);
    for (int j = cur; true; j = (j - 1) & cur) {
      A[i | j] = (A[i | j] + 1LL * s[i] * s[j]) % MX;
      if (j == 0) break;
    }
  }
  fwh(false);
  for (int i = 0; i < N; ++i) C[i] = (1LL * C[i] * C[i]) % MX;
  fwh(true);
  for (int i = 0; i < N; ++i) {
    A[i] = (1LL * A[i] * fib[i]) % MX;
    B[i] = (1LL * B[i] * fib[i]) % MX;
    C[i] = (1LL * C[i] * fib[i]) % MX;
  }
  for (int i = 0; i <= 16; ++i)
    for (int j = 0; j < N; ++j)
      if (!(j & (1 << i))) {
        A[j] = (A[j] + A[j + (1 << i)]) % MX;
        B[j] = (B[j] + B[j + (1 << i)]) % MX;
        C[j] = (C[j] + C[j + (1 << i)]) % MX;
      }
  for (int i = 0; i < N; ++i) A[i] = (((1LL * A[i] * B[i]) % MX) * C[i]) % MX;
  for (int i = 0; i <= 16; ++i)
    for (int j = 0; j < N; ++j)
      if (!(j & (1 << i))) A[j] = (A[j] - A[j + (1 << i)]) % MX;
  long long int sum = 0;
  for (int i = 1; i < N; i *= 2) sum = (sum + A[i]) % MX;
  printf("%lld\n", (sum + MX) % MX);
  return 0;
}