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 inf = 1e9 + 7;
const long long linf = 1ll * inf * inf;
const int N = 500000 + 7;
const int M = 1600;
const int multipleTest = 0;
const double pi = acos(-1);
int fpow(int n, long long k, int p = (int)1e9 + 7) {
  int r = 1;
  for (; k; k >>= 1) {
    if (k & 1) r = (long long)r * n % p;
    n = (long long)n * n % p;
  }
  return r;
}
void XORFFT(int a[], int n, int p, int invert) {
  for (int i = 1; i < n; i <<= 1) {
    for (int j = 0; j < n; j += i << 1) {
      for (int k = 0; k < i; k++) {
        int u = a[j + k], v = a[i + j + k];
        a[j + k] = u + v;
        if (a[j + k] >= p) a[j + k] -= p;
        a[i + j + k] = u - v;
        if (a[i + j + k] < 0) a[i + j + k] += p;
      }
    }
  }
  if (invert) {
    long long inv = fpow(n, p - 2, p);
    for (int i = 0; i < n; i++) a[i] = a[i] * inv % p;
  }
}
void ANDFFT(int a[], int n, int p, int invert) {
  for (int i = 1; i < n; i <<= 1) {
    for (int j = 0; j < n; j += i << 1) {
      for (int k = 0; k < i; k++) {
        int u = a[j + k], v = a[i + j + k];
        if (!invert) {
          a[j + k] = v;
          a[i + j + k] = u + v;
          if (a[i + j + k] >= p) a[i + j + k] -= p;
        } else {
          a[j + k] = v - u;
          if (a[j + k] < 0) a[j + k] += p;
          a[i + j + k] = u;
        }
      }
    }
  }
}
const int maxn = N;
int n;
int a[maxn];
int b[maxn];
int L[N];
int sumXor[N];
long long G[N];
void doXOR() {
  fill_n(a, maxn, 0);
  fill_n(b, maxn, 0);
  for (int i = 0; i < n; i++) a[i] = b[i] = L[i];
  XORFFT(a, n, inf, 0);
  XORFFT(b, n, inf, 0);
  for (int i = 0; i < n; i++) a[i] = (long long)a[i] * b[i] % inf;
  XORFFT(a, n, inf, 1);
  for (int i = 0; i < n; i++) {
    sumXor[i] = a[i];
  }
}
long long f[N];
void doAND() {
  fill_n(a, maxn, 0);
  fill_n(b, maxn, 0);
  for (int i = 0; i < n; i++) a[i] = f[i] * L[i] % inf;
  for (int i = 0; i < n; i++) b[i] = f[i] * sumXor[i] % inf;
  ANDFFT(a, n, inf, 0);
  ANDFFT(b, n, inf, 0);
  for (int i = 0; i < n; ++i) a[i] = (long long)a[i] * b[i] % inf;
  ANDFFT(a, n, inf, 1);
  for (int i = 0; i < n; i++) {
    sumXor[i] = a[i];
  }
}
int m;
void solve() {
  n = 1 << 17;
  fill_n(L, n, 0);
  cin >> m;
  int full = (1 << 17) - 1;
  for (int i = (0), _b = (m); i < _b; ++i) {
    int u;
    scanf("%d", &u);
    L[u]++;
  }
  doXOR();
  f[0] = 0;
  f[1] = 1;
  for (int mask = (2), _b = (1 << 17); mask < _b; ++mask) {
    f[mask] = (f[mask - 1] + f[mask - 2]) % inf;
  }
  doAND();
  for (int mask = (0), _b = (1 << 17); mask < _b; ++mask) {
    int inv = mask ^ full;
    for (int subMask = inv;; subMask = (subMask - 1) & inv) {
      if (!(mask & subMask)) {
        G[mask | subMask] += 1ll * L[mask] * L[subMask];
      }
      if (!subMask) break;
    }
  }
  for (int mask = (0), _b = (1 << 17); mask < _b; ++mask) G[mask] %= inf;
  n = 1 << 17;
  fill_n(a, maxn, 0);
  fill_n(b, maxn, 0);
  for (int i = 0; i < n; i++) a[i] = f[i] * G[i] % inf;
  for (int i = 0; i < n; i++) b[i] = sumXor[i] % inf;
  ANDFFT(a, n, inf, 0);
  ANDFFT(b, n, inf, 0);
  for (int i = 0; i < n; ++i) a[i] = (long long)a[i] * b[i] % inf;
  ANDFFT(a, n, inf, 1);
  for (int i = 0; i < n; i++) {
    sumXor[i] = a[i];
  }
  long long res = 0;
  for (int j = (0), _b = (17); j < _b; ++j) {
    int mask = 1 << j;
    res = (res + sumXor[mask]) % inf;
  }
  cout << res;
}
int main() {
  int Test = 1;
  if (multipleTest) cin >> Test;
  for (int i = 0; i < Test; ++i) {
    solve();
  }
}