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;
inline void read(int &x) {
  x = 0;
  char c = getchar();
  while (c < '0' || c > '9') c = getchar();
  while (c >= '0' && c <= '9') {
    x = x * 10 + (c & 15);
    c = getchar();
  }
}
int lim;
inline long long add(long long a) {
  return a >= 1000000007 ? a - 1000000007 : a;
}
inline long long dec(long long a) { return a < 0 ? a + 1000000007 : a; }
void OR(long long *a, int flag) {
  for (int mid = 1; mid < lim; mid <<= 1) {
    for (int i = 0; i < lim; i += mid * 2) {
      for (int j = 0; j < mid; ++j) {
        if (flag == 1)
          a[i + j + mid] = add(a[i + j + mid] + a[i + j]);
        else
          a[i + j + mid] = dec(a[i + j + mid] - a[i + j]);
      }
    }
  }
}
void AND(long long *a, int flag) {
  for (int mid = 1; mid < lim; mid <<= 1) {
    for (int i = 0; i < lim; i += mid * 2) {
      for (int j = 0; j < mid; ++j) {
        if (flag == 1)
          a[i + j] = add(a[i + j] + a[i + j + mid]);
        else
          a[i + j] = dec(a[i + j] - a[i + j + mid]);
      }
    }
  }
}
void XOR(long long *a, long long flag) {
  long long x;
  for (int mid = 1; mid < lim; mid <<= 1) {
    for (int i = 0; i < lim; i += mid * 2) {
      for (int j = 0; j < mid; ++j) {
        x = a[i + j];
        a[i + j] = (a[i + j] + a[i + j + mid]) * flag % 1000000007;
        a[i + j + mid] = dec(x - a[i + j + mid]) * flag % 1000000007;
      }
    }
  }
}
int hc, num[200005], n, cnt[200005];
long long a[18][200005], b[18][200005], A[200005], B[200005], f[200005];
int main() {
  scanf("%d", &n);
  lim = 1 << 17;
  for (int x, i = 1; i <= n; ++i) {
    read(x);
    ++num[x];
  }
  f[1] = 1;
  for (int i = 2; i < lim; ++i) f[i] = (f[i - 1] + f[i - 2]) % 1000000007;
  for (int i = 0; i < lim; ++i) {
    cnt[i] = cnt[i >> 1] + (i & 1);
    a[cnt[i]][i] = num[i];
    A[i] = num[i];
    B[i] = f[i] * num[i] % 1000000007;
  }
  for (int i = 0; i <= 17; ++i) OR(a[i], 1);
  for (int len = 0; len <= 17; ++len) {
    for (int i = 0; i <= len; ++i) {
      for (int j = 0; j < lim; ++j) {
        b[len][j] = (b[len][j] + a[i][j] * a[len - i][j]) % 1000000007;
      }
    }
    OR(b[len], -1);
  }
  XOR(A, 1);
  for (int i = 0; i < lim; ++i) A[i] = A[i] * A[i] % 1000000007;
  XOR(A, 500000004);
  for (int i = 0; i < lim; ++i) A[i] = A[i] * f[i] % 1000000007;
  AND(A, 1);
  AND(B, 1);
  for (int i = 0; i < lim; ++i) A[i] = A[i] * B[i] % 1000000007;
  for (int i = 0; i < lim; ++i) B[i] = b[cnt[i]][i] * f[i] % 1000000007;
  AND(B, 1);
  for (int i = 0; i < lim; ++i) A[i] = A[i] * B[i] % 1000000007;
  AND(A, -1);
  long long ans = 0;
  for (int i = 1; i < lim; i <<= 1) ans = (ans + A[i]) % 1000000007;
  printf("%lld", ans);
  return 0;
}