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 = 1e9 + 7, sz = 1 << 17;
const long long mod2 = 1LL * mod * mod;
int add(int x, int y) {
  int ans = x + y;
  if (ans >= mod) ans -= mod;
  return ans;
}
int subtract(int x, int y) {
  if (x >= y) return x - y;
  return x - y + mod;
}
int mul(int x, int y) { return 1LL * x * y % mod; }
void adto(int &x, int y) {
  x += y;
  if (x >= mod) x -= mod;
}
int power(int a, int b) {
  int p = 1;
  for (int i = 0; (1 << i) <= b; i++) {
    if (b & (1 << i)) p = mul(p, a);
    a = mul(a, a);
  }
  return p;
}
void to_transform(int dim, int data[], int type) {
  for (int len = 1; 2 * len <= dim; len <<= 1)
    for (int i = 0; i < dim; i += 2 * len)
      for (int j = 0; j < len; j++) {
        int u = data[i + j], v = data[i + len + j];
        if (type == 0) {
          data[i + j] = v;
          data[i + len + j] = add(u, v);
          continue;
        } else if (type == 1) {
          data[i + j] = add(u, v);
          data[i + j + len] = subtract(u, v);
          continue;
        }
      }
}
void inv_transform(int dim, int data[], int type) {
  for (int len = 1; 2 * len <= dim; len <<= 1)
    for (int i = 0; i < dim; i += 2 * len)
      for (int j = 0; j < len; j++) {
        int u = data[i + j], v = data[i + len + j];
        if (type == 0) {
          data[i + j] = subtract(v, u);
          data[i + len + j] = u;
          continue;
        } else if (type == 1) {
          data[i + j] = add(u, v);
          data[i + j + len] = subtract(u, v);
          continue;
        }
      }
  if (type == 1) {
    int inv = power(dim, mod - 2);
    for (int i = 0; i < dim; i++) data[i] = mul(data[i], inv);
  }
}
int N, aux[sz], data[sz], data3[sz], f[sz];
void doFirst(int data[], int v[]) {
  for (int i = 0; i < sz; i++) {
    long long val = 0;
    for (int j = i;; j = (j - 1) & i) {
      val += 1LL * data[j] * data[i ^ j];
      if (val >= mod2) val -= mod2;
      if (j == 0) break;
    }
    v[i] = val % mod;
  }
}
int main() {
  scanf("%d", &N);
  for (int i = 1; i <= N; i++) {
    int x;
    scanf("%d", &x);
    data[x]++;
  }
  f[0] = 0, f[1] = 1;
  for (int i = 2; i < sz; i++) f[i] = add(f[i - 1], f[i - 2]);
  memcpy(aux, data, sizeof(data));
  doFirst(aux, data3);
  to_transform(sz, data, 1);
  for (int i = 0; i < sz; i++) data[i] = mul(data[i], data[i]);
  inv_transform(sz, data, 1);
  for (int i = 0; i < sz; i++)
    data3[i] = mul(data3[i], f[i]), data[i] = mul(data[i], f[i]),
    aux[i] = mul(aux[i], f[i]);
  to_transform(sz, data, 0);
  to_transform(sz, data3, 0);
  to_transform(sz, aux, 0);
  for (int i = 0; i < sz; i++) data[i] = mul(data[i], mul(data3[i], aux[i]));
  inv_transform(sz, data, 0);
  int ans = 0;
  for (int i = 0; (1 << i) < sz; i++) adto(ans, data[1 << i]);
  printf("%d\n", ans);
  return 0;
}