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>
int n, i, j, x;
long long S, a[131072], b[131072], c[131072], an[131072], f[131072];
void FWT(long long* a, int n, int f, int op) {
  int i, j, k;
  long long x, y;
  for (i = 1; i < n; i *= 2)
    for (j = 0; j < n; j += i * 2) {
      for (k = 0; k < i; k++) {
        x = a[j + k];
        y = a[i + j + k];
        if (f == 1) {
          a[j + k] = (x + y) % 1000000007;
          if (op == 1) a[i + j + k] = (x - y + 1000000007) % 1000000007;
        } else {
          if (op == 1)
            a[j + k] = 500000004 * (x + y) % 1000000007,
                  a[i + j + k] = 500000004 * (x - y + 1000000007) % 1000000007;
          if (op == 2) a[j + k] = (x - y + 1000000007) % 1000000007;
        }
      }
    }
}
void mul(long long* a, long long* b, long long* c, int n, int op) {
  static long long A[131072], B[131072];
  for (int i = 0; i < n; i++) A[i] = a[i], B[i] = b[i];
  FWT(A, n, 1, op);
  FWT(B, n, 1, op);
  for (int i = 0; i < n; i++) c[i] = A[i] * B[i] % 1000000007;
  FWT(c, n, -1, op);
}
int main() {
  scanf("%d", &n);
  for (i = 1; i <= n; i++) scanf("%d", &x), c[x]++;
  mul(c, c, a, 131072, 1);
  for (i = 0; i < 131072; b[i] = (b[i] + c[0] * c[i]) % 1000000007, i++)
    for (j = i; j; j = (j - 1) & i)
      b[i] = (b[i] + c[j] * c[i - j]) % 1000000007;
  for (f[1] = 1, i = 2; i < 131072; i++)
    f[i] = (f[i - 1] + f[i - 2]) % 1000000007;
  for (i = 0; i < 131072; i++)
    a[i] = a[i] * f[i] % 1000000007, b[i] = b[i] * f[i] % 1000000007,
    c[i] = c[i] * f[i] % 1000000007;
  mul(a, b, an, 131072, 2);
  mul(c, an, an, 131072, 2);
  for (i = 1; i < 131072; i *= 2) S = (S + an[i]) % 1000000007;
  printf("%I64d", S);
}