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 read() {
  int x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
inline void Add(int &x, int y) {
  x += y;
  if (x >= 1000000007) x -= 1000000007;
  if (x < 0) x += 1000000007;
}
const int inv2 = (1000000007 + 1) / 2;
inline void FWT_and(int *F, int n) {
  for (int s = 2; s <= n; s <<= 1)
    for (int i = 0; i < n; i += s)
      for (int j = 0; j < s / 2; j++) {
        int x = F[i + j], y = F[i + j + s / 2];
        F[i + j] = (x + y) % 1000000007;
        F[i + j + s / 2] = y;
      }
}
inline void IFWT_and(int *F, int n) {
  for (int s = 2; s <= n; s <<= 1)
    for (int i = 0; i < n; i += s)
      for (int j = 0; j < s / 2; j++) {
        int x = F[i + j], y = F[i + j + s / 2];
        F[i + j] = (x - y + 1000000007) % 1000000007;
        F[i + j + s / 2] = y;
      }
}
inline void FWT_xor(int *F, int n) {
  for (int s = 2; s <= n; s <<= 1)
    for (int i = 0; i < n; i += s)
      for (int j = 0; j < s / 2; j++) {
        int x = F[i + j], y = F[i + j + s / 2];
        F[i + j] = (x + y) % 1000000007;
        F[i + j + s / 2] = (x - y + 1000000007) % 1000000007;
      }
}
inline void IFWT_xor(int *F, int n) {
  for (int s = 2; s <= n; s <<= 1)
    for (int i = 0; i < n; i += s)
      for (int j = 0; j < s / 2; j++) {
        int x = F[i + j], y = F[i + j + s / 2];
        F[i + j] = 1ll * (x + y) % 1000000007 * inv2 % 1000000007;
        F[i + j + s / 2] =
            1ll * (x - y + 1000000007) % 1000000007 * inv2 % 1000000007;
      }
}
int n, s[400010], fib[400010], F1[400010], F2[400010], F3[400010], Ans;
int main() {
  n = read();
  for (int i = 1; i <= n; i++) s[read()]++;
  fib[1] = 1;
  for (int i = 2; i <= 200000; i++)
    fib[i] = (fib[i - 1] + fib[i - 2]) % 1000000007;
  for (int i = 0; i < (1 << 17); i++) {
    Add(F1[i], 1ll * s[0] * s[i] % 1000000007);
    for (int j = i; j; j = (j - 1) & i)
      Add(F1[i], 1ll * s[j] * s[i ^ j] % 1000000007);
  }
  for (int i = 0; i < (1 << 17); i++) F1[i] = 1ll * F1[i] * fib[i] % 1000000007;
  for (int i = 0; i < (1 << 17); i++) F3[i] = 1ll * s[i] * fib[i] % 1000000007;
  for (int i = 0; i < (1 << 17); i++) F2[i] = s[i];
  FWT_xor(F2, (1 << 17));
  for (int i = 0; i < (1 << 17); i++) F2[i] = 1ll * F2[i] * F2[i] % 1000000007;
  IFWT_xor(F2, (1 << 17));
  for (int i = 0; i < (1 << 17); i++) F2[i] = 1ll * F2[i] * fib[i] % 1000000007;
  FWT_and(F1, (1 << 17));
  FWT_and(F2, (1 << 17));
  FWT_and(F3, (1 << 17));
  for (int i = 0; i < (1 << 17); i++)
    F1[i] = 1ll * F1[i] * F2[i] % 1000000007 * F3[i] % 1000000007;
  IFWT_and(F1, (1 << 17));
  for (int i = 0; i < 17; i++) Add(Ans, F1[1 << i]);
  cout << Ans << endl;
  return 0;
}