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;
inline int read() {
  char ch = getchar();
  int nega = 1;
  while (!isdigit(ch)) {
    if (ch == '-') nega = -1;
    ch = getchar();
  }
  int ans = 0;
  while (isdigit(ch)) {
    ans = ans * 10 + ch - 48;
    ch = getchar();
  }
  if (nega == -1) return -ans;
  return ans;
}
inline int min(int x, int y, int z) { return min(x, min(y, z)); }
inline int max(int x, int y, int z) { return max(x, max(y, z)); }
inline int add(int x, int y) {
  return x + y >= 1000000007 ? x + y - 1000000007 : x + y;
}
inline int add(int x, int y, int z) { return add(add(x, y), z); }
inline int sub(int x, int y) { return x - y < 0 ? x - y + 1000000007 : x - y; }
inline int mul(int x, int y) { return 1LL * x * y % 1000000007; }
inline int mul(int x, int y, int z) { return mul(mul(x, y), z); }
inline void div2(int &x) {
  if (x & 1)
    x = (x + 1000000007) >> 1;
  else
    x >>= 1;
}
int cnt[200005], fi[200005];
int a[200005], b[200005], c[200005], t[200005], x[200005], h[200005], n = 17;
int f[18][200005];
void fwt_or(int a[], int typ) {
  for (int i = 1; i < (1 << n); i <<= 1) {
    for (int j = 0; j < (1 << n); j += (i << 1)) {
      for (int k = 0; k < i; k++) {
        if (typ == 1)
          a[i + j + k] = add(a[i + j + k], a[j + k]);
        else
          a[i + j + k] = sub(a[i + j + k], a[j + k]);
      }
    }
  }
}
void fwt_xor(int a[], int typ) {
  for (int i = 1; i < (1 << n); i <<= 1) {
    for (int j = 0; j < (1 << n); j += (i << 1)) {
      for (int k = 0; k < i; k++) {
        int x = a[j + k], y = a[i + j + k];
        a[j + k] = add(x, y), a[i + j + k] = sub(x, y);
        if (typ == -1) div2(a[i + j + k]), div2(a[j + k]);
      }
    }
  }
}
void fwt_and(int a[], int typ) {
  for (int i = 1; i < (1 << n); i <<= 1) {
    for (int j = 0; j < (1 << n); j += (i << 1)) {
      for (int k = 0; k < i; k++) {
        if (typ == 1)
          a[k + j] = add(a[i + j + k], a[j + k]);
        else
          a[k + j] = sub(a[j + k], a[i + j + k]);
      }
    }
  }
}
void solve() {
  for (int i = 0; i < (1 << n); i++) f[cnt[i]][i] = x[i];
  for (int i = 0; i <= n; i++) fwt_or(f[i], 1);
  for (int i = 0; i <= n; i++) {
    for (int j = 0; j < (1 << n); j++) h[j] = 0;
    for (int j = 0; j <= i; j++) {
      for (int k = 0; k < (1 << n); k++)
        h[k] = add(h[k], mul(f[j][k], f[i - j][k]));
    }
    fwt_or(h, -1);
    for (int j = 0; j < (1 << n); j++)
      if (cnt[j] == i) a[j] = add(a[j], h[j]);
  }
}
signed main() {
  int k = read();
  for (int i = 1; i <= k; i++) t[read()]++;
  for (int i = 0; i < (1 << n); i++) cnt[i] = __builtin_popcount(i);
  fi[1] = 1;
  for (int i = 2; i < (1 << n); i++) fi[i] = add(fi[i - 1], fi[i - 2]);
  for (int i = 0; i < (1 << n); i++) x[i] = t[i];
  solve();
  for (int i = 0; i < (1 << n); i++) a[i] = mul(a[i], fi[i]);
  for (int i = 0; i < (1 << n); i++) b[i] = mul(t[i], fi[i]);
  for (int i = 0; i < (1 << n); i++) x[i] = t[i];
  fwt_xor(x, 1);
  for (int i = 0; i < (1 << n); i++) x[i] = mul(x[i], x[i]);
  fwt_xor(x, -1);
  for (int i = 0; i < (1 << n); i++) c[i] = mul(x[i], fi[i]);
  fwt_and(a, 1);
  fwt_and(b, 1);
  fwt_and(c, 1);
  for (int i = 0; i < (1 << n); i++) a[i] = mul(a[i], b[i], c[i]);
  fwt_and(a, -1);
  int ans = 0;
  for (int i = 0; i <= n; i++) ans = add(ans, a[1 << i]);
  cout << ans << endl;
  return 0;
}