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;
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
const long long int N = 1 << 17;
const long long int inv = 742744451;
long long int cnt[N], fib[N];
vector<long long int> poly[3];
long long int rev(long long int n) {
  long long int res = 0;
  for (long long int i = 0; i < 17; i++)
    if (n & (1 << i)) res |= 1 << (16 - i);
  return res;
}
void xor_fft(vector<long long int> &a, bool invert) {
  for (long long int i = 0; i < N; i++)
    if (i < rev(i)) swap(a[i], a[rev(i)]);
  for (long long int len = 2; len <= N; len <<= 1) {
    for (long long int i = 0; i < N; i += len) {
      for (long long int j = 0; j < len / 2; j++) {
        long long int u = a[i + j], v = a[i + j + len / 2];
        a[i + j] = ((u + v) >= 1000000007 ? (u + v - 1000000007) : u + v);
        a[i + j + len / 2] = ((u - v) < 0 ? (u - v + 1000000007) : u - v);
      }
    }
  }
  if (invert)
    for (auto &i : a) i = (i * inv) % 1000000007;
}
void and_fft(vector<long long int> &a, bool invert) {
  for (long long int i = 0; i < N; i++)
    if (i < rev(i)) swap(a[i], a[rev(i)]);
  for (long long int len = 2; len <= N; len <<= 1) {
    for (long long int i = 0; i < N; i += len) {
      for (long long int j = 0; j < len / 2; j++) {
        long long int u = a[i + j], v = a[i + j + len / 2];
        if (invert) {
          a[i + j] = ((v - u) < 0 ? (v - u + 1000000007) : v - u);
          a[i + j + len / 2] = u;
        } else {
          a[i + j] = v;
          a[i + j + len / 2] =
              ((u + v) >= 1000000007 ? (u + v - 1000000007) : u + v);
        }
      }
    }
  }
}
vector<long long int> multiply(vector<long long int> a, vector<long long int> b,
                               bool isxor) {
  vector<long long int> res(N);
  if (isxor) {
    xor_fft(a, 0);
    xor_fft(b, 0);
    for (long long int i = 0; i < N; i++) a[i] = (a[i] * b[i]) % 1000000007;
    xor_fft(a, 1);
    for (long long int i = 0; i < N; i++) res[i] = a[i];
  } else {
    and_fft(a, 0);
    and_fft(b, 0);
    for (long long int i = 0; i < N; i++) a[i] = (a[i] * b[i]) % 1000000007;
    and_fft(a, 1);
    for (long long int i = 0; i < N; i++) res[i] = a[i];
  }
  return res;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  fib[1] = 1;
  for (long long int i = 2; i < N; i++)
    fib[i] = (fib[i - 1] + fib[i - 2]) % 1000000007;
  for (long long int i = 0; i < 3; i++) poly[i].resize(N);
  long long int n;
  cin >> n;
  long long int s[n + 1];
  for (long long int i = 1; i <= n; i++)
    cin >> s[i], cnt[s[i]]++, poly[1][s[i]]++;
  for (long long int i = 0; i < N; i++) {
    poly[0][i] = (poly[0][i] + cnt[i] * cnt[0]) % 1000000007;
    long long int x = (i ^ (N - 1));
    for (long long int j = x; j; j = (j - 1) & x)
      poly[0][i | j] = (poly[0][i | j] + cnt[i] * cnt[j]) % 1000000007;
  }
  poly[2] = multiply(poly[1], poly[1], 1);
  for (long long int i = 0; i < N; i++)
    for (long long int j = 0; j < 3; j++)
      poly[j][i] = (poly[j][i] * fib[i]) % 1000000007;
  poly[0] = multiply(poly[0], poly[1], 0);
  poly[0] = multiply(poly[0], poly[2], 0);
  long long int ans = 0;
  for (long long int i = 1; i < N; i <<= 1)
    ans = (ans + poly[0][i]) % 1000000007;
  cout << ans;
}