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;
template <typename T>
inline void read(T &x) {
  x = 0;
  T k = 1;
  char c = getchar();
  while (!isdigit(c)) {
    if (c == '-') k = -1;
    c = getchar();
  }
  while (isdigit(c)) {
    x = x * 10 + c - '0';
    c = getchar();
  }
  x *= k;
}
const int len = 1 << 17;
const int N = len | 7;
const int p = 1e9 + 7;
const int Inv2 = (p + 1) >> 1;
inline int add(int a, int b) {
  a += b;
  if (a >= p) a -= p;
  return a;
}
inline int sub(int a, int b) {
  a -= b;
  if (a < 0) a += p;
  return a;
}
inline void FWT_or(int *A, bool opt = 1) {
  for (int i = 1; i < len; i <<= 1) {
    for (int j = 0; j < len; j += i << 1) {
      for (int k = 0; k < i; ++k) {
        A[j + k + i] =
            opt ? add(A[j + k], A[j + k + i]) : sub(A[j + k + i], A[j + k]);
      }
    }
  }
}
inline void FWT_and(int *A, bool opt = 1) {
  for (int i = 1; i < len; i <<= 1) {
    for (int j = 0; j < len; j += i << 1) {
      for (int k = 0; k < i; ++k) {
        A[j + k] =
            opt ? add(A[j + k], A[j + k + i]) : sub(A[j + k], A[j + k + i]);
      }
    }
  }
}
inline void FWT_xor(int *A, bool opt = 1) {
  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 u = A[j + k], v = A[j + k + i];
        A[j + k] = add(u, v);
        A[j + k + i] = sub(u, v);
        if (!opt) {
          A[j + k] = (long long)A[j + k] * Inv2 % p;
          A[j + k + i] = (long long)A[j + k + i] * Inv2 % p;
        }
      }
    }
  }
}
int cnt[N], A[N], B[N], C[N], F[N], fib[N], bit[N];
int t[20][N], f[20][N];
int main() {
  int n;
  read(n);
  for (int i = 1, x; i <= n; ++i) {
    read(x), ++cnt[x];
  }
  for (int i = 0; i < len; ++i) {
    t[bit[i] = (bit[i >> 1] + (i & 1))][i] = cnt[i];
  }
  for (int i = 0; i <= 17; ++i) {
    FWT_or(t[i]);
  }
  for (int i = 0; i <= 17; ++i) {
    for (int j = 0; i + j <= 17; ++j) {
      for (int k = 0; k < len; ++k) {
        f[i + j][k] = add(f[i + j][k], (long long)t[i][k] * t[j][k] % p);
      }
    }
  }
  for (int i = 0; i <= 17; ++i) FWT_or(f[i], 0);
  for (int i = 0; i < len; ++i) {
    A[i] = f[bit[i]][i];
  }
  for (int i = 0; i < len; ++i) {
    B[i] = cnt[i];
  }
  FWT_xor(cnt);
  for (int i = 0; i < len; ++i) {
    C[i] = (long long)cnt[i] * cnt[i] % p;
  }
  FWT_xor(C, 0);
  fib[1] = 1;
  for (int i = 2; i < len; ++i) {
    fib[i] = add(fib[i - 1], fib[i - 2]);
  }
  for (int i = 0; i < len; ++i) {
    A[i] = (long long)A[i] * fib[i] % p;
    B[i] = (long long)B[i] * fib[i] % p;
    C[i] = (long long)C[i] * fib[i] % p;
  }
  FWT_and(A);
  FWT_and(B);
  FWT_and(C);
  for (int i = 0; i < len; ++i) {
    F[i] = (long long)A[i] * B[i] % p * C[i] % p;
  }
  FWT_and(F, 0);
  int ans = 0;
  for (int i = 1; i < len; i <<= 1) {
    ans = add(ans, F[i]);
  }
  printf("%d\n", ans);
}