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;
int mod = 1000000007LL;
long long large = 2000000000000000000LL;
long long rev = (mod + 1) / 2;
void FWT(vector<long long> &a, int n) {
  for (int d = 1; d < n; d <<= 1)
    for (int m = d << 1, i = 0; i < n; i += m)
      for (int j = 0; j < d; j++) {
        long long x = a[i + j], y = a[i + j + d];
        a[i + j] = (x + y) % mod, a[i + j + d] = (x - y + mod) % mod;
      }
}
void UFWT(vector<long long> &a, int n) {
  for (int d = 1; d < n; d <<= 1)
    for (int m = d << 1, i = 0; i < n; i += m)
      for (int j = 0; j < d; j++) {
        long long x = a[i + j], y = a[i + j + d];
        a[i + j] = 1LL * (x + y) * rev % mod,
              a[i + j + d] = (1LL * (x - y) * rev % mod + mod) % mod;
      }
}
void FWT2(vector<long long> &a, int n) {
  for (int d = 1; d < n; d <<= 1)
    for (int m = d << 1, i = 0; i < n; i += m)
      for (int j = 0; j < d; j++) {
        long long x = a[i + j], y = a[i + j + d];
        a[i + j] = (x + y) % mod;
      }
}
void UFWT2(vector<long long> &a, int n) {
  for (int d = 1; d < n; d <<= 1)
    for (int m = d << 1, i = 0; i < n; i += m)
      for (int j = 0; j < d; j++) {
        long long x = a[i + j], y = a[i + j + d];
        a[i + j] = (x - y + mod) % mod;
      }
}
int main() {
  int n;
  int l = 17;
  vector<long long> fib((1 << (l + 1)) + 10, 0);
  fib[0] = 0;
  fib[1] = 1;
  for (int i = 2; i < (int)fib.size(); i++) {
    fib[i] = fib[i - 1] + fib[i - 2];
    fib[i] %= mod;
  }
  cin >> n;
  vector<int> a(1 << l, 0);
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    a[x]++;
  }
  vector<long long> cnt1(1 << l, 0);
  for (int i = 0; i < (1 << l); i++) {
    int s = i;
    for (int mask = s;; mask = s & (mask - 1)) {
      cnt1[s] += 1LL * a[mask] * a[s ^ mask];
      cnt1[s] %= mod;
      if (mask == 0) break;
    }
  }
  vector<long long> cnt2(1 << l, 0);
  for (int i = 0; i < (1 << l); i++) cnt2[i] = 1LL * a[i];
  vector<long long> cnt3 = cnt2;
  FWT(cnt3, 1 << l);
  for (int i = 0; i < (1 << l); i++) {
    cnt3[i] *= cnt3[i];
    cnt3[i] %= mod;
  }
  UFWT(cnt3, 1 << l);
  for (int i = 0; i < (1 << l); i++) {
    cnt1[i] *= fib[i];
    cnt1[i] %= mod;
    cnt2[i] *= fib[i];
    cnt2[i] %= mod;
    cnt3[i] *= fib[i];
    cnt3[i] %= mod;
  }
  FWT2(cnt1, 1 << l);
  FWT2(cnt2, 1 << l);
  FWT2(cnt3, 1 << l);
  vector<long long> cnt = cnt1;
  for (int i = 0; i < (1 << l); i++) {
    cnt[i] *= cnt2[i];
    cnt[i] %= mod;
    cnt[i] *= cnt3[i];
    cnt[i] %= mod;
  }
  UFWT2(cnt, 1 << l);
  long long ans = 0;
  for (int i = 0; i < l; i++) {
    ans += cnt[1 << i];
    ans %= mod;
  }
  cout << ans << endl;
  return 0;
}