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 oo = 0x3f3f3f3f;
const long long ooo = 9223372036854775807ll;
const int _cnt = 1000 * 1000 + 7;
const int _p = 1000 * 1000 * 1000 + 7;
const int N = 300005;
const double PI = acos(-1.0);
const double eps = 1e-9;
int o(int x) { return x % _p; }
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }
void file_put() {
  freopen("filename.in", "r", stdin);
  freopen("filename.out", "w", stdout);
}
void FWT0(long long a[], int n) {
  for (int d = 1; d < n; d <<= 1)
    for (int m = d << 1, i = 0; i < n; i += m)
      for (int j = 0; j < d; j++) {
        int x = a[i + j], y = a[i + j + d];
        a[i + j] = (x + y) % _p, a[i + j + d] = (x - y + _p) % _p;
      }
}
void UFWT0(long long a[], int n) {
  for (int d = 1; d < n; d <<= 1)
    for (int m = d << 1, i = 0; i < n; i += m)
      for (int j = 0; j < d; j++) {
        int x = a[i + j], y = a[i + j + d];
        a[i + j] = 1ll * (x + y) * 500000004 % _p,
              a[i + j + d] = (1ll * (x - y) * 500000004 % _p + _p) % _p;
      }
}
void FWT1(long long a[], int n) {
  for (int d = 1; d < n; d <<= 1)
    for (int m = d << 1, i = 0; i < n; i += m)
      for (int j = 0; j < d; j++) {
        int x = a[i + j], y = a[i + j + d];
        a[i + j] = (x + y) % _p;
      }
}
void UFWT1(long long a[], int n) {
  for (int d = 1; d < n; d <<= 1)
    for (int m = d << 1, i = 0; i < n; i += m)
      for (int j = 0; j < d; j++) {
        int x = a[i + j], y = a[i + j + d];
        a[i + j] = (x - y + _p) % _p;
      }
}
void FST(long long *a, int n, long long *f) {
  memset(f, 0, sizeof(f));
  for (int i = 0; i <= n; i++) {
    for (int j = i;; j = (j - 1) & i) {
      f[i] += a[j] * a[i ^ j];
      if (j == 0) break;
    }
    f[i] %= _p;
  }
}
int n, x;
long long ans = 0, a[N], b[N], c[N], f[N];
int main() {
  scanf("%d", &n);
  for (int i = (1); i <= (n); ++i) scanf("%d", &x), b[x]++, c[x]++;
  n = (1 << 17) - 1, FST(b, n, a);
  FWT0(c, n);
  for (int i = (0); i <= (n); ++i) c[i] = c[i] * c[i] % _p;
  UFWT0(c, n);
  f[1] = 1;
  for (int i = (2); i <= (n); ++i) f[i] = (f[i - 1] + f[i - 2]) % _p;
  for (int i = (0); i <= (n); ++i)
    a[i] = a[i] * f[i] % _p, b[i] = b[i] * f[i] % _p, c[i] = c[i] * f[i] % _p;
  FWT1(a, n), FWT1(b, n), FWT1(c, n);
  for (int i = (0); i <= (n); ++i) a[i] = a[i] * b[i] % _p * c[i] % _p;
  UFWT1(a, n);
  for (int i = (0); i <= (16); ++i) (ans += a[1 << i]) %= _p;
  printf("%I64d\n", ans);
  return 0;
}