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 S = 1 << 17, p = 1e9 + 7, inv2 = (p + 1) >> 1;
inline void A(int &x, int y) {
  x += y;
  if (x >= p) x -= p;
}
struct Dx {
  int f[S];
  int &operator[](int x) { return f[x]; }
} a, d, fib;
inline Dx operator*(Dx a, Dx b) {
  for (int i = 0; i < S; ++i) a[i] = 1ll * a[i] * b[i] % p;
  return a;
}
inline void fwt(Dx &a, int ty) {
  for (int d = 1; d < S; d <<= 1)
    for (int m = d << 1, i = 0; i < S; i += m)
      for (int j = 0; j < d; ++j) {
        int x = a[i + j], y = a[i + j + d];
        if (ty == 0)
          A(a[i + j], y);
        else
          a[i + j] = (x - y + p) % p, a[i + j + d] = (x + y) % p;
      }
}
inline void ufwt(Dx &a, int ty) {
  for (int d = 1; d < S; d <<= 1)
    for (int m = d << 1, i = 0; i < S; i += m)
      for (int j = 0; j < d; ++j) {
        int x = a[i + j], y = a[i + j + d];
        if (ty == 0)
          A(a[i + j], p - y);
        else
          a[i + j] = 1ll * (x + y) * inv2 % p,
                a[i + j + d] = 1ll * (y - x + p) * inv2 % p;
      }
}
inline Dx operator&(Dx a, Dx b) {
  fwt(a, 0);
  fwt(b, 0);
  a = a * b;
  ufwt(a, 0);
  return a;
}
inline Dx operator^(Dx a, Dx b) {
  fwt(a, 1);
  fwt(b, 1);
  a = a * b;
  ufwt(a, 1);
  return a;
}
int n;
int main() {
  scanf("%d", &n);
  for (int i = 1, x; i <= n; ++i) scanf("%d", &x), ++a[x];
  fib[0] = 0;
  fib[1] = 1;
  for (int i = 2; i < S; ++i) A(fib[i], fib[i - 1] + fib[i - 2]);
  for (int i = 0; i < S; ++i) {
    for (int j = i; j; j = (j - 1) & i) A(d[i], 1ll * a[j] * a[i ^ j] % p);
    A(d[i], 1ll * a[0] * a[i] % p);
  }
  d = (d * fib) & (a * fib) & ((a ^ a) * fib);
  int ans = 0;
  for (int i = 1; i < S; i <<= 1) A(ans, d[i]);
  printf("%d", ans);
  return 0;
}