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 MOD = (int)1e9 + 7;
int add(int x, int y) {
  x += y;
  if (x >= MOD) return x - MOD;
  return x;
}
int sub(int x, int y) {
  x -= y;
  if (x < 0) return x + MOD;
  return x;
}
int mult(int x, int y) { return ((long long)x * y) % MOD; }
int bin_pow(int x, int p) {
  if (p == 0) return 1;
  if (p & 1) return mult(x, bin_pow(x, p - 1));
  return bin_pow(mult(x, x), p / 2);
}
int rev(int x) { return bin_pow(x, MOD - 2); }
const int K = 17;
const int N = (1 << K);
const int NN = N + 7;
int a[NN];
int b[NN];
int c[NN];
int f[NN];
int main() {
  f[0] = 0;
  f[1] = 1;
  for (int i = 2; i < N; i++) f[i] = add(f[i - 1], f[i - 2]);
  int n;
  scanf("%d", &n);
  while (n--) {
    int x;
    scanf("%d", &x);
    a[x]++;
  }
  for (int mask = 0; mask < N; mask++) {
    b[mask] = mult(a[mask], a[0]);
    for (int nmask = mask; nmask > 0; nmask = (nmask - 1) & mask)
      b[mask] = add(b[mask], mult(a[nmask], a[mask ^ nmask]));
  }
  for (int mask = 0; mask < N; mask++) c[mask] = a[mask];
  for (int k = 0; k < K; k++) {
    for (int mask = 0; mask < N; mask++) {
      if ((mask >> k) & 1) continue;
      int nmask = mask ^ (1 << k);
      int x = add(c[mask], c[nmask]);
      int y = sub(c[mask], c[nmask]);
      c[mask] = x;
      c[nmask] = y;
    }
  }
  for (int mask = 0; mask < N; mask++) c[mask] = mult(c[mask], c[mask]);
  for (int k = 0; k < K; k++) {
    for (int mask = 0; mask < N; mask++) {
      if ((mask >> k) & 1) continue;
      int nmask = mask ^ (1 << k);
      int x = add(c[mask], c[nmask]);
      int y = sub(c[mask], c[nmask]);
      c[mask] = x;
      c[nmask] = y;
    }
  }
  int rN = rev(N);
  for (int mask = 0; mask < N; mask++) c[mask] = mult(c[mask], rN);
  for (int mask = 0; mask < N; mask++) {
    a[mask] = mult(a[mask], f[mask]);
    b[mask] = mult(b[mask], f[mask]);
    c[mask] = mult(c[mask], f[mask]);
  }
  for (int k = 0; k < K; k++) {
    for (int mask = 0; mask < N; mask++) {
      if ((mask >> k) & 1) continue;
      a[mask] = add(a[mask], a[mask ^ (1 << k)]);
      b[mask] = add(b[mask], b[mask ^ (1 << k)]);
      c[mask] = add(c[mask], c[mask ^ (1 << k)]);
    }
  }
  for (int mask = 0; mask < N; mask++)
    a[mask] = mult(a[mask], mult(b[mask], c[mask]));
  for (int k = 0; k < K; k++) {
    for (int mask = 0; mask < N; mask++) {
      if ((mask >> k) & 1) continue;
      a[mask] = sub(a[mask], a[mask ^ (1 << k)]);
    }
  }
  int ans = 0;
  for (int mask = 1; mask < N; mask <<= 1) ans = add(ans, a[mask]);
  printf("%d\n", ans);
  return 0;
}