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;
  char c = getchar();
  bool flag = false;
  while (!isdigit(c)) {
    if (c == '-') flag = true;
    c = getchar();
  }
  while (isdigit(c)) {
    x = (x << 1) + (x << 3) + (c ^ 48);
    c = getchar();
  }
  if (flag) x = -x;
}
long long n, ans;
long long cnt[280010], fib[280010], f[25][280010], g[25][280010], a[280010],
    b[280010], c[280010];
void FWT_or(long long *a, int type) {
  for (int len = 1; len < (1 << 17); len <<= 1)
    for (int i = 0; i < (1 << 17); i += len << 1)
      for (int j = i; j < i + len; ++j)
        a[j + len] = (a[j + len] + a[j] * type + 1000000007) % 1000000007;
}
void FWT_and(long long *a, int type) {
  for (int len = 1; len < (1 << 17); len <<= 1)
    for (int i = 0; i < (1 << 17); i += len << 1)
      for (int j = i; j < i + len; ++j)
        a[j] = (a[j] + a[j + len] * type + 1000000007) % 1000000007;
}
void FWT_xor(long long *a, int type) {
  for (int len = 1; len < (1 << 17); len <<= 1) {
    for (int i = 0; i < (1 << 17); i += len << 1) {
      for (int j = i; j < i + len; ++j) {
        long long x = a[j], y = a[j + len];
        a[j] = (x + y) % 1000000007,
        a[j + len] = (x - y + 1000000007) % 1000000007;
        if (type != 1)
          a[j] = a[j] * 500000004 % 1000000007,
          a[j + len] = a[j + len] * 500000004 % 1000000007;
      }
    }
  }
}
void init() {
  fib[1] = 1;
  for (int i = 2; i < (1 << 17); ++i)
    fib[i] = (fib[i - 1] + fib[i - 2]) % 1000000007;
  for (int i = 1; i < (1 << 17); ++i) cnt[i] = cnt[i - (i & (-i))] + 1;
}
int main() {
  init(), read(n);
  for (int i = 1; i <= n; ++i) {
    long long x;
    read(x);
    g[cnt[x]][x]++, b[x]++, c[x]++;
  }
  for (int i = 0; i <= 17; ++i) FWT_or(g[i], 1);
  for (int i = 0; i <= 17; ++i)
    for (int j = 0; j <= i; ++j)
      for (int s = 0; s < (1 << 17); ++s)
        f[i][s] = (f[i][s] + g[i - j][s] * g[j][s] % 1000000007) % 1000000007;
  for (int i = 0; i <= 17; ++i) FWT_or(f[i], -1);
  FWT_xor(c, 1);
  for (int i = 0; i < (1 << 17); ++i) c[i] = c[i] * c[i] % 1000000007;
  FWT_xor(c, -1);
  for (int i = 0; i < (1 << 17); ++i) {
    a[i] = fib[i] * f[cnt[i]][i] % 1000000007;
    b[i] = b[i] * fib[i] % 1000000007, c[i] = c[i] * fib[i] % 1000000007;
  }
  FWT_and(a, 1), FWT_and(b, 1), FWT_and(c, 1);
  for (int i = 0; i < (1 << 17); ++i)
    a[i] = a[i] * b[i] % 1000000007 * c[i] % 1000000007;
  FWT_and(a, -1);
  for (int i = 1; i < (1 << 17); i <<= 1) ans = (ans + a[i]) % 1000000007;
  printf("%lld", ans);
  return 0;
}