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;
long long powmod(long long x, long long y = 1000000007 - 2,
                 long long p = 1000000007) {
  long long ans = 1;
  while (y) {
    if (y & 1) ans = ans * x % p;
    x = x * x % p;
    y >>= 1;
  }
  return ans;
}
int n, Lis[1000010];
const int Lim = 1 << 17;
long long SA[Lim], SB[Lim], SC[Lim], F[Lim];
void _xor(long long *X) {
  for (int b = 1; b < Lim; b *= 2)
    for (int i = 0; i < Lim; i += b + b)
      for (int j = 0; j < b; j++) {
        long long A = X[i + j], B = X[i + j + b];
        X[i + j] = A + B;
        X[i + j + b] = A - B;
      }
  for (int i = 0; i < Lim; i++) X[i] %= 1000000007;
}
void _and(long long *X) {
  for (int b = 1; b < Lim; b *= 2)
    for (int i = 0; i < Lim; i += b + b)
      for (int j = 0; j < b; j++) {
        X[i + j] += X[i + j + b];
      }
  for (int i = 0; i < Lim; i++) X[i] %= 1000000007;
}
void _and2(long long *X) {
  for (int b = 1; b < Lim; b *= 2)
    for (int i = 0; i < Lim; i += b + b)
      for (int j = 0; j < b; j++) {
        X[i + j] -= X[i + j + b];
      }
  for (int i = 0; i < Lim; i++) X[i] %= 1000000007;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &Lis[i]);
  F[1] = 1;
  for (int i = 2; i < Lim; i++) F[i] = (F[i - 1] + F[i - 2]) % 1000000007;
  for (int i = 1; i <= n; i++) {
    SA[Lis[i]]++;
    SB[Lis[i]]++;
  }
  for (int i = 0; i < Lim; i++)
    for (int j = Lim - i - 1;; j = (j - 1) & (Lim - i - 1)) {
      SC[i + j] = (SC[i + j] + SA[i] * SA[j]) % 1000000007;
      if (!j) break;
    }
  _xor(SB);
  for (int i = 0; i < Lim; i++) SB[i] = SB[i] * SB[i] % 1000000007;
  _xor(SB);
  int r = powmod(Lim);
  for (int i = 0; i < Lim; i++) SB[i] = SB[i] * r % 1000000007;
  for (int i = 0; i < Lim; i++) SA[i] = SA[i] * F[i] % 1000000007;
  for (int i = 0; i < Lim; i++) SB[i] = SB[i] * F[i] % 1000000007;
  for (int i = 0; i < Lim; i++) SC[i] = SC[i] * F[i] % 1000000007;
  _and(SC);
  _and(SB);
  _and(SA);
  for (int i = 0; i < Lim; i++)
    SA[i] = SA[i] * SB[i] % 1000000007 * SC[i] % 1000000007;
  _and2(SA);
  long long ans = 0;
  for (int i = 1; i < Lim; i *= 2) ans = (ans + SA[i]) % 1000000007;
  printf("%lld\n", (ans % 1000000007 + 1000000007) % 1000000007);
  return 0;
}