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 long long read() {
  long long x = 0;
  bool f = 1;
  char s = getchar();
  while ((s < '0' || s > '9') && s > 0) {
    if (s == '-') f ^= 1;
    s = getchar();
  }
  while (s >= '0' && s <= '9') x = (x << 1) + (x << 3) + s - '0', s = getchar();
  return f ? x : -x;
}
inline long long ksm(long long a, long long b, long long mo) {
  long long res = 1;
  for (; b; b >>= 1, a = a * a % mo)
    if (b & 1) res = res * a % mo;
  return res;
}
const long long inv2 = ksm(2, 1000000007ll - 2, 1000000007ll);
inline void FWTOR(int* a, int n, int inv) {
  for (int k = 2; k <= n; k <<= 1)
    for (int i = 0; i < n; i += k)
      for (int j = i; j < i + (k >> 1); j++)
        a[j + (k >> 1)] =
            (1000000007ll + a[j + (k >> 1)] + a[j] * inv) % 1000000007ll;
}
inline void FWTAND(int* a, int n, int inv) {
  for (int k = 2; k <= n; k <<= 1)
    for (int i = 0; i < n; i += k)
      for (int j = i; j < i + (k >> 1); j++)
        a[j] = (1000000007ll + a[j] + a[j + (k >> 1)] * inv) % 1000000007ll;
}
inline void FWTXOR(int* a, int n, int inv) {
  long long in2 = inv > 0 ? 1 : inv2, a0, a1;
  for (int k = 2; k <= n; k <<= 1)
    for (int i = 0; i < n; i += k)
      for (int j = i; j < i + (k >> 1); j++)
        a0 = a[j], a1 = a[j + (k >> 1)],
        a[j] = (a0 + a1) % 1000000007ll * in2 % 1000000007ll,
        a[j + (k >> 1)] =
            (a0 - a1 + 1000000007ll) % 1000000007ll * in2 % 1000000007ll;
}
int n, nm[131080], fi[131080], s[1000005], ac[20][131080], ca[20][131080],
    cb[131080];
int a[131080], b[131080], c[131080], ans, bt;
signed main() {
  n = read();
  for (int i = 1; i < (1 << 17); i++) nm[i] = nm[i >> 1] + (i & 1);
  for (int i = 1; i <= n; i++) s[i] = read(), ca[nm[s[i]]][s[i]]++, cb[s[i]]++;
  for (int i = 1; i <= n; i++)
    while ((1 << bt) <= s[i]) bt++;
  fi[1] = 1;
  for (int i = 2; i < (1 << bt); i++)
    fi[i] = (0ll + fi[i - 1] + fi[i - 2]) % 1000000007ll;
  for (int i = 0; i < (1 << bt); i++) c[i] = 1ll * cb[i] * fi[i] % 1000000007ll;
  FWTXOR(cb, 1 << bt, 1);
  for (int i = 0; i < (1 << bt); i++)
    cb[i] = 1ll * cb[i] * cb[i] % 1000000007ll;
  FWTXOR(cb, 1 << bt, -1);
  for (int i = 0; i <= bt; i++) {
    FWTOR(ca[i], 1 << bt, 1);
    for (int k = 0; k < (1 << bt); k++) {
      ac[i][k] = 0;
      for (int j = 0; j <= i; j++)
        ac[i][k] = (1ll * ca[j][k] * ca[i - j][k] + ac[i][k]) % 1000000007ll;
    }
    FWTOR(ac[i], 1 << bt, -1);
  }
  for (int i = 0; i < (1 << bt); i++) ac[0][i] = ac[nm[i]][i];
  for (int i = 0; i < (1 << bt); i++)
    a[i] = 1ll * ac[0][i] * fi[i] % 1000000007ll,
    b[i] = 1ll * cb[i] * fi[i] % 1000000007ll;
  FWTAND(a, 1 << bt, 1), FWTAND(b, 1 << bt, 1), FWTAND(c, 1 << bt, 1);
  for (int i = 0; i < (1 << bt); i++)
    a[i] = 1ll * a[i] * b[i] % 1000000007ll * c[i] % 1000000007ll;
  FWTAND(a, 1 << bt, -1);
  for (int i = 0; i < bt; i++) ans = (0ll + ans + a[1 << i]) % 1000000007ll;
  printf("%d\n", ans);
  return 0;
}