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>
const int w = 1 << 17;
const int p = 1000000007;
int da[w], db[w], dc[w], dd[w], fib[w];
int i, j, k, n, s, t;
inline int power(int x, int y) {
  int s = 1;
  for (int i = 30; i >= 0; i--) {
    s = 1LL * s * s % p;
    if ((1 << i) & y) s = 1LL * s * x % p;
  }
  return s;
}
inline void FWT_AND(int *g, int t) {
  for (i = 1; i < w; i = i << 1)
    for (j = 0; j < w; j = j + (i << 1))
      for (k = 0; k < i; k++)
        g[j + k] = ((g[j + k] + g[i + j + k] * t) % p + p) % p;
  return;
}
inline void FWT_XOR(int *g, int t) {
  int x, y, r = power(2, p - 2);
  for (i = 1; i < w; i = i << 1)
    for (j = 0; j < w; j = j + (i << 1))
      for (k = 0; k < i; k++) {
        x = g[j + k], y = g[i + j + k];
        g[j + k] = (x + y) % p, g[i + j + k] = (x - y + p) % p;
        if (t == -1)
          g[j + k] = 1LL * g[j + k] * r % p,
                g[i + j + k] = 1LL * g[i + j + k] * r % p;
      }
  return;
}
int main() {
  scanf("%d", &n);
  for (i = 1; i <= n; i++) scanf("%d", &t), dc[t]++;
  fib[0] = 0, fib[1] = 1;
  for (i = 2; i < w; i++) fib[i] = (fib[i - 1] + fib[i - 2]) % p;
  for (i = 0; i < w; i++)
    for (j = i;; j = (j - 1) & i) {
      db[i] = (db[i] + 1LL * dc[j] * dc[i ^ j]) % p;
      if (!j) break;
    }
  FWT_XOR(dc, 1);
  for (i = 0; i < w; i++) dd[i] = 1LL * dc[i] * dc[i] % p;
  FWT_XOR(dc, -1);
  FWT_XOR(dd, -1);
  for (i = 0; i < w; i++) db[i] = 1LL * db[i] * fib[i] % p;
  for (i = 0; i < w; i++) dc[i] = 1LL * dc[i] * fib[i] % p;
  for (i = 0; i < w; i++) dd[i] = 1LL * dd[i] * fib[i] % p;
  FWT_AND(db, 1);
  FWT_AND(dc, 1);
  FWT_AND(dd, 1);
  for (i = 0; i < w; i++) da[i] = 1LL * db[i] % p * dc[i] % p * dd[i] % p;
  FWT_AND(da, -1);
  for (i = 0; i < 17; i++) s = (s + da[1 << i]) % p;
  printf("%d", s);
  return 0;
}