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;
void smain();
int main() {
  ios_base::sync_with_stdio(0);
  smain();
  return 0;
}
inline long long lg(long long x) {
  long long n = 1;
  for (; (1 << n) < x; ++n)
    ;
  return n;
}
inline void acc(long long &x, long long y) {
  if ((x += y) >= 1000000007) x -= 1000000007;
}
inline long long add(long long x, long long y) {
  long long r = x + y;
  return r >= 1000000007 ? r - 1000000007 : r;
}
inline long long pmod(long long a, long long n) {
  long long res = 1;
  for (; n; n >>= 1, a = a * a % 1000000007)
    if (n & 1) res = res * a % 1000000007;
  return res;
}
vector<long long> subset_conv(const vector<long long> &a) {
  long long n = lg(a.size()), m = a.size();
  vector<vector<long long> > d(n + 1, vector<long long>(a.size()));
  d[0].assign(m, a[0]);
  for (long long i = 1; i <= n; ++i) {
    for (long long mask = 0; mask < m; mask++)
      d[i][mask] = __builtin_popcount(mask) == i ? a[mask] : 0;
    for (long long k = 0; k < n; k++) {
      for (long long mask = 0; mask < m; mask++) {
        if ((mask >> k) & 1) acc(d[i][mask], d[i][mask ^ (1 << k)]);
      }
    }
  }
  vector<long long> res(m);
  vector<vector<long long> > d2(n + 1, vector<long long>(a.size()));
  for (long long i = 0; i < n + 1; i++) {
    for (long long mask = 0; mask < m; mask++) {
      for (long long j = 0; j <= i; ++j) {
        acc(d2[i][mask], d[j][mask] * d[i - j][mask] % 1000000007);
      }
    }
  }
  for (long long k = 0; k < n + 1; k++) {
    for (long long i = 0; i < n; i++) {
      for (long long mask = 0; mask < m; mask++) {
        if ((mask >> i) & 1) {
          acc(d2[k][mask], 1000000007 - d2[k][mask ^ (1 << i)]);
        }
      }
    }
  }
  for (long long mask = 0; mask < m; mask++)
    res[mask] = d2[__builtin_popcount(mask)][mask];
  return res;
}
void hadamard(vector<long long> &a) {
  long long n = a.size();
  for (long long len = 2; len <= n; len <<= 1) {
    for (long long i = 0; i < n; i += len) {
      for (long long j = 0; j < len / 2; j++) {
        long long u = a[i + j], v = a[i + j + len / 2];
        a[i + j] = add(u, v);
        a[i + j + len / 2] = add(u, 1000000007 - v);
      }
    }
  }
}
vector<long long> xor_conv(const vector<long long> &a) {
  vector<long long> res = a;
  hadamard(res);
  for (auto &i : res) i = i * i % 1000000007;
  hadamard(res);
  long long norm = pmod(a.size(), 1000000007 - 2);
  for (auto &i : res) i = i * norm % 1000000007;
  return res;
}
void and_transform(vector<long long> &a, bool invert = false) {
  long long n = a.size();
  for (long long len = 2; len <= n; len <<= 1) {
    for (long long i = 0; i < n; i += len) {
      for (long long j = 0; j < len / 2; j++) {
        long long u = a[i + j], v = a[i + j + len / 2];
        a[i + j] = invert ? add(1000000007 - u, v) : v;
        a[i + j + len / 2] = invert ? u : add(u, v);
      }
    }
  }
}
void smain() {
  long long n;
  for (; cin >> n;) {
    vector<long long> a(n);
    for (long long i = 0; i < n; i++) cin >> a[i];
    long long m = lg(*max_element(a.begin(), a.end()) + 1);
    long long mm = 1 << m;
    vector<long long> cnt(mm);
    for (long long i = 0; i < n; i++) cnt[a[i]] += 1;
    vector<long long> f(mm);
    f[1] = 1;
    for (long long i = 2; i < mm; ++i) f[i] = add(f[i - 1], f[i - 2]);
    vector<long long> r = subset_conv(cnt);
    for (long long i = 0; i < mm; i++) r[i] = r[i] * f[i] % 1000000007;
    and_transform(r);
    vector<long long> x = xor_conv(cnt);
    for (long long i = 0; i < mm; i++) x[i] = x[i] * f[i] % 1000000007;
    and_transform(x);
    for (long long i = 0; i < mm; i++) cnt[i] = cnt[i] * f[i] % 1000000007;
    and_transform(cnt);
    for (long long i = 0; i < mm; i++)
      r[i] = r[i] * x[i] % 1000000007 * cnt[i] % 1000000007;
    and_transform(r, 1);
    long long res = 0;
    for (long long i = 1; i < mm; i <<= 1) acc(res, r[i]);
    cout << res << endl;
  }
}