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;
long long inverse_m(long long a, long long b, long long s0 = 1LL,
                    long long s1 = 0LL) {
  return b == 0 ? s0 : inverse_m(b, a % b, s1, s0 - s1 * (a / b));
}
vector<long long> ORANDO(vector<long long> &a) {
  vector<long long> ans(1 << 17, 0LL);
  for (int i = 0; i < 1 << 17; i++) {
    for (int j = i; j >= 0; j = (j - 1) & i) {
      long long mult = a[i ^ j] * a[j];
      ans[i] = (ans[i] + mult) % 1000000007;
      if (j == 0) break;
    }
  }
  return ans;
}
int T[3][2][2][2] = {{{{1, 1}, {1, -1}}, {{1, 1}, {1, -1}}},
                     {{{0, 1}, {1, 1}}, {{-1, 1}, {1, 0}}},
                     {{{1, 1}, {1, 0}}, {{0, 1}, {1, -1}}}};
void FFT(vector<long long> &a, int op, bool inverse = false) {
  long long u1 = T[op][inverse][0][0], v1 = T[op][inverse][0][1];
  long long u2 = T[op][inverse][1][0], v2 = T[op][inverse][1][1];
  for (int b = 0; b < 17; b++)
    for (int i = 0; i < 1 << 17; i++)
      if ((i & (1 << b)) == 0) {
        long long u = a[i], v = a[i + (1 << b)];
        a[i] = (u * u1) + (v * v1);
        if (a[i] >= 1000000007) a[i] -= 1000000007;
        if (a[i] < 0) a[i] += 1000000007;
        a[i + (1 << b)] = (u * u2) + (v * v2);
        if (a[i + (1 << b)] >= 1000000007) a[i + (1 << b)] -= 1000000007;
        if (a[i + (1 << b)] < 0) a[i + (1 << b)] += 1000000007;
      }
  if (op == 0 && inverse) {
    long long inv = inverse_m(1 << 17, 1000000007);
    for (int i = 0; i < a.size(); i++) a[i] = (a[i] * inv) % 1000000007;
  }
}
vector<long long> convolution(vector<long long> a, vector<long long> b,
                              int op) {
  FFT(a, op, false);
  FFT(b, op, false);
  for (int i = 0; i < a.size(); i++) a[i] = (a[i] * b[i]) % 1000000007;
  FFT(a, op, true);
  return a;
}
long long fibo[1 << 17];
void build() {
  fibo[1] = 1LL;
  for (long long i = 2LL; i < 1 << 17; i++)
    fibo[i] = (fibo[i - 1] + fibo[i - 2]) % 1000000007;
}
void print(vector<long long> &a, int sz) {
  for (int i = 0; i < sz; i++) cout << a[i] << " ";
  cout << endl;
}
int main() {
  int n;
  scanf("%d", &n);
  vector<long long> arr(1 << 17, 0LL);
  for (int i = 0; i < n; i++) {
    long long x;
    scanf("%lld", &x);
    arr[x] += 1LL;
  }
  build();
  vector<long long> oris = ORANDO(arr);
  vector<long long> xoris = convolution(arr, arr, 0);
  for (int i = 0; i < oris.size(); i++)
    oris[i] = (fibo[i] * oris[i]) % 1000000007;
  for (int i = 0; i < xoris.size(); i++)
    xoris[i] = (xoris[i] * fibo[i]) % 1000000007;
  for (int i = 0; i < arr.size(); i++) arr[i] = (fibo[i] * arr[i]) % 1000000007;
  vector<long long> andis = convolution(oris, arr, 1);
  vector<long long> ans = convolution(andis, xoris, 1);
  long long resp = 0LL;
  for (long long i = 1LL; i < (1 << 17); i *= 2LL) {
    resp = (resp + ans[i]) % 1000000007;
  }
  printf("%lld\n", resp);
  return 0;
}