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>
T read1() {
  T t = 0;
  char k;
  bool vis = 0;
  do (k = getchar()) == '-' && (vis = 1);
  while ('0' > k || k > '9');
  while ('0' <= k && k <= '9')
    t = (t << 3) + (t << 1) + (k ^ '0'), k = getchar();
  return vis ? -t : t;
}
int s, a[18][131072], b[131072], c[131072];
template <typename T>
void FWT_or(T *a, int s, int k) {
  for (int i = 1, j = 2; j <= s; i <<= 1, j <<= 1)
    for (int x = 0; x < s; x += j)
      for (int y = 0; y < i; ++y)
        a[i + x + y] = (a[i + x + y] + a[x + y] * k) % 1000000007;
}
template <typename T>
void FWT_and(T *a, int s, int k) {
  for (int i = 1, j = 2; j <= s; i <<= 1, j <<= 1)
    for (int x = 0; x < s; x += j)
      for (int y = 0; y < i; ++y)
        a[x + y] = (a[x + y] + a[i + x + y] * k) % 1000000007;
}
template <typename T>
void FWT_xor(T *a, int s, int k) {
  for (int i = 1, j = 2; j <= s; i <<= 1, j <<= 1)
    for (int x = 0; x < s; x += j)
      for (int y = 0; y < i; ++y) {
        a[i + x + y] = (a[x + y] - a[i + x + y]) % 1000000007;
        a[x + y] = (a[x + y] + a[x + y] - a[i + x + y]) % 1000000007;
        if (k != 1)
          a[i + x + y] = 1ll * a[i + x + y] * k % 1000000007,
                    a[x + y] = 1ll * a[x + y] * k % 1000000007;
      }
}
int main() {
  s = read1<long long>();
  for (int i = 0, x = 0; i < s; ++i)
    x = read1<long long>(), ++a[__builtin_popcount(x)][x], ++c[x];
  for (int i = 0; i < 18; ++i) FWT_or(a[i], 131072, 1);
  for (int i = 18; i--;) {
    for (int j = 0; j <= i; ++j)
      for (int k = 0; k < 131072; ++k)
        b[k] = (b[k] + 1ll * a[j][k] * a[i - j][k]) % 1000000007;
    memcpy(a[i], b, sizeof(b));
    memset(b, 0, sizeof(b));
    FWT_or(a[i], 131072, -1);
  }
  memcpy(b, c, 131072 << 2);
  FWT_xor(c, 131072, 1);
  for (int i = 0; i < 131072; ++i) c[i] = 1ll * c[i] * c[i] % 1000000007;
  FWT_xor(c, 131072, 500000004);
  a[0][0] = b[0] = c[0] = 0;
  for (int i = 1, x = 0, y = 1; i < 131072;
       ++i, y ^= x ^= y ^= x = (x + y) % 1000000007) {
    a[0][i] = 1ll * y * a[__builtin_popcount(i)][i] % 1000000007;
    b[i] = 1ll * y * b[i] % 1000000007;
    c[i] = 1ll * y * c[i] % 1000000007;
  }
  FWT_and(c, 131072, 1);
  FWT_and(a[0], 131072, 1);
  FWT_and(b, 131072, 1);
  for (int i = 0; i < 131072; ++i)
    b[i] = 1ll * a[0][i] * b[i] % 1000000007 * c[i] % 1000000007;
  FWT_and(b, 131072, -1);
  int ans = 0;
  for (int i = 1; i < 131072; i <<= 1) ans = (ans + b[i]) % 1000000007;
  cout << (ans + 1000000007) % 1000000007;
  return 0;
}