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;
const int MAXN = (1 << 17);
const long long int MOD = 1000000007;
long long int fib[MAXN], ctr[MAXN], p1[MAXN], p2[MAXN], p3[MAXN], p4[MAXN];
long long int power(long long int a, long long int b) {
  if (!b) return 1;
  long long int ans = power(a, b / 2);
  ans = (ans * ans) % MOD;
  if (b % 2) ans = (ans * a) % MOD;
  return ans;
}
void transform1(long long int A[], bool invert) {
  for (int len = 1; 2 * len <= MAXN; len *= 2) {
    for (int i = 0; i < MAXN; i += (2 * len)) {
      for (int j = 0; j < len; ++j) {
        long long int u = A[i + j];
        long long int v = A[i + len + j];
        A[i + j] = (u + v) % MOD;
        A[i + len + j] = (u + MOD - v) % MOD;
      }
    }
  }
  if (invert) {
    for (int i = 0; i < MAXN; ++i) {
      A[i] = (A[i] * power(MAXN, MOD - 2)) % MOD;
    }
  }
}
void transform2(long long int A[], bool invert) {
  for (int len = 1; 2 * len <= MAXN; len *= 2) {
    for (int i = 0; i < MAXN; i += (2 * len)) {
      for (int j = 0; j < len; ++j) {
        long long int u = A[i + j];
        long long int v = A[i + len + j];
        if (!invert) {
          A[i + j] = v;
          A[i + len + j] = (u + v) % MOD;
        } else {
          A[i + j] = (-u + MOD + v) % MOD;
          A[i + len + j] = u;
        }
      }
    }
  }
}
int main(int argc, char const *argv[]) {
  fib[0] = 0;
  fib[1] = 1;
  for (int i = 2; i < MAXN; ++i) {
    fib[i] = (fib[i - 1] + fib[i - 2]) % MOD;
  }
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    int x;
    scanf("%d", &x);
    ctr[x]++;
  }
  for (int mask = 0; mask < MAXN; ++mask) {
    for (int submask = mask; submask > 0; submask = ((submask - 1) & mask)) {
      int m2 = (mask ^ submask);
      p1[mask] = (p1[mask] + ctr[submask] * ctr[m2]) % MOD;
    }
    p1[mask] = (p1[mask] + ctr[mask] * ctr[0]) % MOD;
    p1[mask] = (p1[mask] * fib[mask]) % MOD;
  }
  for (int mask = 0; mask < MAXN; ++mask) {
    p2[mask] = (ctr[mask] * fib[mask]) % MOD;
  }
  transform1(ctr, false);
  for (int mask = 0; mask < MAXN; ++mask) {
    ctr[mask] = (ctr[mask] * ctr[mask]) % MOD;
  }
  transform1(ctr, true);
  for (int mask = 0; mask < MAXN; ++mask) {
    p3[mask] = (ctr[mask] * fib[mask]) % MOD;
  }
  transform2(p1, false);
  transform2(p2, false);
  transform2(p3, false);
  for (int mask = 0; mask < MAXN; ++mask) {
    p4[mask] = (p1[mask] * p2[mask]) % MOD;
    p4[mask] = (p4[mask] * p3[mask]) % MOD;
  }
  transform2(p4, true);
  long long int ans = 0;
  for (int i = 0; i < 17; ++i) {
    ans = (ans + p4[(1 << i)]) % MOD;
  }
  printf("%lld\n", ans);
  return 0;
}