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 = 1000000007;
const long long inv2 = (mod + 1) / 2;
const int MAXN = (1 << 17);
void fft(vector<int> &a, int low, int high) {
  if (low == high - 1) return;
  int len = (high - low) / 2, mid = low + len;
  fft(a, low, mid);
  fft(a, mid, high);
  for (int i = low; i < mid; i++) {
    int x1 = a[i];
    int x2 = a[i + len];
    a[i] = (x1 - x2) % mod;
    a[i + len] = (x1 + x2) % mod;
  }
}
void inv_fft(vector<int> &a, int low, int high) {
  if (low == high - 1) return;
  int len = (high - low) / 2, mid = low + len;
  for (int i = low; i < mid; i++) {
    int y1 = a[i];
    int y2 = a[i + len];
    a[i] = (y1 + y2) * inv2 % mod;
    a[i + len] = (y2 - y1) * inv2 % mod;
  }
  inv_fft(a, low, mid);
  inv_fft(a, mid, high);
}
vector<int> mul1(vector<int> A, vector<int> B) {
  fft(A, 0, A.size());
  fft(B, 0, B.size());
  vector<int> res(A.size());
  for (int i = 0; i < res.size(); i++) res[i] = A[i] * (long long)B[i] % mod;
  inv_fft(res, 0, res.size());
  return res;
}
vector<int> mul2(vector<int> A, vector<int> B) {
  vector<int> res(A.size());
  for (int m = 0; m < res.size(); ++m) {
    long long sum = 0;
    for (int s = m; s; s = (s - 1) & m) {
      sum += A[s] * (long long)B[m ^ s];
    }
    sum += A[0] * (long long)B[m];
    res[m] = sum % mod;
  }
  return res;
}
void conv(vector<int> &x) {
  for (int b = 1; b < x.size(); b *= 2) {
    for (int s = 0; s < x.size(); s += 2 * b)
      for (int i = s; i < s + b; ++i) {
        x[i] = (x[i] + x[i ^ b]) % mod;
      }
  }
}
void convinv(vector<long long> &x) {
  for (int b = 1; b < x.size(); b *= 2) {
    for (int s = 0; s < x.size(); s += 2 * b)
      for (int i = s; i < s + b; ++i) {
        x[i] = (x[i] - x[i ^ b]) % mod;
      }
  }
}
vector<int> f(vector<int> a) {
  vector<int> fib(a.size());
  fib[1] = 1;
  for (int i = 2; i < fib.size(); ++i) fib[i] = (fib[i - 1] + fib[i - 2]) % mod;
  for (int i = 0; i < a.size(); ++i) {
    a[i] = a[i] * (long long)fib[i] % mod;
  }
  conv(a);
  return a;
}
int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  int n;
  cin >> n;
  vector<int> a(MAXN);
  for (int i = 0; i < n; ++i) {
    int x;
    cin >> x;
    ++a[x];
  }
  vector<int> b = mul1(a, a);
  vector<int> c = mul2(a, a);
  a = f(a);
  b = f(b);
  c = f(c);
  vector<long long> res(a.size());
  for (int i = 0; i < a.size(); ++i) {
    res[i] = a[i] * (long long)b[i] % mod * c[i] % mod;
  }
  convinv(res);
  long long sum = 0;
  for (int b = 1; b < a.size(); b *= 2) {
    sum += res[b];
  }
  cout << (sum % mod + mod) % mod << endl;
  return 0;
}