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 inv;
long long mypow(long long a, long long e) {
  if (!e) return 1;
  a %= 1000000007LL;
  if (e & 1) return (a * mypow(a * a, e / 2)) % 1000000007LL;
  return mypow(a * a, e / 2);
}
int T[2][2][2][2] = {{{{1, 1}, {1, -1}}, {{1, 1}, {1, -1}}},
                     {{{0, 1}, {1, 1}}, {{-1, 1}, {1, 0}}}};
void FFT(vector<long long> &a, int op, bool inverse = false) {
  int u1 = T[op][inverse][0][0], v1 = T[op][inverse][0][1];
  int 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;
        a[i + (1 << b)] = u * u2 + v * v2;
        if (a[i] >= 1000000007LL) a[i] -= 1000000007LL;
        if (a[i] < 0) a[i] += 1000000007LL;
        if (a[i + (1 << b)] >= 1000000007LL) a[i + (1 << b)] -= 1000000007LL;
        if (a[i + (1 << b)] < 0) a[i + (1 << b)] += 1000000007LL;
      }
  if (op == 0 && inverse)
    for (int i = 0; i < a.size(); i++) a[i] = (a[i] * inv) % 1000000007LL;
}
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]) % 1000000007LL;
  }
  FFT(a, op, true);
  return a;
}
vector<long long> other_convolution(vector<long long> a) {
  vector<long long> ret((1 << 17));
  for (int mask = 0; mask < (1 << 17); mask++)
    for (int subset = mask;; subset = (subset - 1) & mask) {
      ret[mask] = (ret[mask] + a[subset] * a[mask ^ subset]) % 1000000007LL;
      if (!subset) break;
    }
  return ret;
}
vector<long long> a((1 << 17)), b((1 << 17)), c((1 << 17)), fib((1 << 17));
int n, x;
int main() {
  fib[1] = 1;
  for (int i = 2; i < (1 << 17); i++)
    fib[i] = (fib[i - 2] + fib[i - 1]) % 1000000007LL;
  inv = mypow((1 << 17), 1000000007LL - 2);
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &x);
    b[x]++;
  }
  c = convolution(b, b, 0);
  a = other_convolution(b);
  for (int i = 0; i < (1 << 17); i++) {
    a[i] = (a[i] * fib[i]) % 1000000007LL;
    b[i] = (b[i] * fib[i]) % 1000000007LL;
    c[i] = (c[i] * fib[i]) % 1000000007LL;
  }
  a = convolution(a, b, 1);
  a = convolution(a, c, 1);
  long long sum = 0;
  for (int i = 0; i < 17; i++) {
    sum = (sum + a[1 << i]) % 1000000007LL;
  }
  printf("%lld\n", sum);
  return 0;
}