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 NMAX = 2e5 + 4;
const long long N = 1 << 17;
const long long MOD = 1e9 + 7;
const long double pi = 3.141592653589793238462643383;
const int IMAX = 2e9;
template <class T>
using max_pq = priority_queue<T>;
template <class T>
using min_pq = priority_queue<T, vector<T>, greater<T>>;
long long x, y;
template <class T>
T gcd(T a, T b) {
  if (a == 0) {
    x = 0, y = 1;
    return b;
  }
  T gc = gcd(b % a, a);
  T temp;
  temp = x;
  x = y - (b / a) * temp;
  y = temp;
  return gc;
}
long long po(long long a, long long x, long long m) {
  if (x == 0) {
    return 1;
  }
  long long ans = 1;
  long long k = 1;
  while (k <= x) {
    if (x & k) {
      ans = ((ans * a) % m);
    }
    k <<= 1;
    a *= a;
    a %= m;
  }
  return ans;
}
long long cnt[NMAX];
long long fib[NMAX];
long long orr[NMAX];
long long ans[NMAX];
long long andr[NMAX];
void fft_xor(bool inverse) {
  for (int len = 1; 2 * len <= N; len <<= 1) {
    for (int i = 0; i < N; i += 2 * len) {
      for (int j = 0; j < len; j++) {
        long long u = cnt[i + j];
        long long v = cnt[i + len + j];
        cnt[i + j] = (u + v) % MOD;
        cnt[i + len + j] = (u - v + MOD) % MOD;
      }
    }
  }
  if (inverse) {
    gcd(MOD, N);
    y += MOD;
    y %= MOD;
    for (int i = 0; i < N; i++) cnt[i] = (cnt[i] * y) % MOD;
  }
}
void fft_and(long long (&P)[NMAX], bool inverse) {
  for (int len = 1; 2 * len <= N; len <<= 1) {
    for (int i = 0; i < N; i += 2 * len) {
      for (int j = 0; j < len; j++) {
        long long u = P[i + j];
        long long v = P[i + len + j];
        if (!inverse) {
          P[i + j] = v;
          P[i + len + j] = (u + v) % MOD;
        } else {
          P[i + j] = (-u + v + MOD) % MOD;
          P[i + len + j] = u;
        }
      }
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  fib[0] = 0;
  fib[1] = 1;
  for (int i = int(2); i <= int(N); i++)
    fib[i] = (fib[i - 1] + fib[i - 2]) % MOD;
  for (int i = int(1); i <= int(n); i++) {
    int a;
    cin >> a;
    cnt[a]++;
  }
  for (int i = int(0); i <= int(N - 1); i++) {
    andr[i] = (cnt[i] * fib[i]) % MOD;
    for (int j = i; j > 0; j = ((j - 1) & i)) {
      orr[i] += cnt[j] * cnt[i ^ j];
      orr[i] %= MOD;
    }
    orr[i] += (cnt[i] * cnt[0]);
    orr[i] %= MOD;
    orr[i] *= fib[i];
    orr[i] %= MOD;
  }
  fft_xor(false);
  for (int i = int(0); i <= int(N - 1); i++) cnt[i] = (cnt[i] * cnt[i]) % MOD;
  fft_xor(true);
  for (int i = int(0); i <= int(N - 1); i++) cnt[i] = (cnt[i] * fib[i]) % MOD;
  fft_and(cnt, false);
  fft_and(andr, false);
  fft_and(orr, false);
  for (int i = int(0); i <= int(N - 1); i++) {
    ans[i] = (((cnt[i] * andr[i]) % MOD) * orr[i]) % MOD;
  }
  fft_and(ans, true);
  long long an = 0;
  for (int i = int(0); i <= int(17); i++) an += ans[(1 << i)];
  an %= MOD;
  cout << an << '\n';
}