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;
int a[(1 << 17)];
int b[(1 << 17)], c[(1 << 17)], d[(1 << 17)];
const int mod = 1e9 + 7;
long long expmod(long long a, long long b, long long mod) {
  long long rlt = 1;
  for (a %= mod; b; a = a * a % mod, b >>= 1)
    if (b & 1) rlt = rlt * a % mod;
  return rlt;
}
void add(int &x, long long y) { x = (x + y) % mod; }
void fwt_xor(int a[], int len, bool fg) {
  for (int half = 1; half < len; half <<= 1) {
    for (int i = 0; i < len; i += half << 1) {
      for (int j = 0; j < half; j++) {
        int x = a[i + j], y = a[i + j + half];
        a[i + j] = (x + y) % mod;
        a[i + j + half] = (x + mod - y) % mod;
      }
    }
  }
  int rev_n = expmod(len, mod - 2, mod);
  if (fg) {
    for (int i = 0; i < len; i++) a[i] = (1ll * rev_n * a[i]) % mod;
  }
}
void fwt(int a[], int len) {
  for (int half = 1; half < len; half <<= 1) {
    for (int i = 0; i < len; i += half << 1) {
      for (int j = 0; j < half; j++) {
        a[i + j] = (a[i + j + half] + a[i + j]) % mod;
      }
    }
  }
}
void ufwt(int a[], int len) {
  for (int half = 1; half < len; half <<= 1) {
    for (int i = 0; i < len; i += half << 1) {
      for (int j = 0; j < half; j++) {
        a[i + j] = (a[i + j] - a[i + j + half] + mod) % mod;
      }
    }
  }
}
int f[(1 << 17)];
int main() {
  f[0] = 0, f[1] = 1;
  for (int i = 2; i < (1 << 17); i++) f[i] = (f[i - 1] + f[i - 2]) % mod;
  int n, s;
  scanf("%d", &n);
  while (n--) {
    scanf("%d", &s);
    a[s]++;
  }
  for (int k = 0; k < (1 << 17); k++) {
    for (int i = k; i; i = (i - 1) & k) {
      add(b[k], 1ll * a[i] * a[k ^ i]);
    }
    add(b[k], 1ll * a[0] * a[k]);
  }
  memcpy(c, a, (1 << 17) * 4);
  fwt_xor(c, (1 << 17), 0);
  for (int i = 0; i < (1 << 17); i++) c[i] = 1ll * c[i] * c[i] % mod;
  fwt_xor(c, (1 << 17), 1);
  for (int i = 0; i < (1 << 17); i++) {
    a[i] = 1ll * a[i] * f[i] % mod;
    b[i] = 1ll * b[i] * f[i] % mod;
    c[i] = 1ll * c[i] * f[i] % mod;
  }
  fwt(a, (1 << 17));
  fwt(b, (1 << 17));
  fwt(c, (1 << 17));
  for (int i = 0; i < (1 << 17); i++) {
    a[i] = 1ll * a[i] * b[i] % mod * c[i] % mod;
  }
  ufwt(a, (1 << 17));
  int ans = 0;
  for (int i = 0; i < 17; i++) add(ans, a[1 << i]);
  cout << ans << endl;
}