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;
char char_read_before = 1;
inline int read() {
  int f = 1, x = 0;
  char s = char_read_before;
  while (s < '0' || s > '9') {
    if (s == '-') f = -1;
    s = getchar();
  }
  while (s >= '0' && s <= '9') {
    x = x * 10 - '0' + s;
    s = getchar();
  }
  char_read_before = s;
  return x * f;
}
inline int readN() {
  int x = 0;
  char s = char_read_before;
  while (s < '0' || s > '9') s = getchar();
  while (s >= '0' && s <= '9') {
    x = ((x << 3) + (x << 1)) + (s ^ 48);
    s = getchar();
  }
  char_read_before = s;
  return x;
}
inline int readone() {
  int x = 0;
  char s = getchar();
  while (s < '0' || s > '9') s = getchar();
  char_read_before = 1;
  return s - '0';
}
int zxy = 1000000007;
int inv2 = (zxy + 1) / 2;
inline int qm(long long x, int dalao) {
  return x >= dalao ? qm(x - dalao, dalao) : x;
}
int n, m, i, j, s, o, k;
inline void DWTXOR(int *s, int m) {
  for (int k = m; k > 1; k >>= 1) {
    for (int i = 0; i < m; i += k) {
      for (int j = i + (k >> 1); j < i + k; j++) {
        int s0 = s[j - (k >> 1)], s1 = s[j];
        s[j] = qm((s0 + 0ll + zxy - s1), zxy);
        s[j - (k >> 1)] = qm((s0 + 0ll + s1), zxy);
      }
    }
  }
  return;
}
inline void IDWTXOR(int *s, int m) {
  for (int k = 2; k <= m; k <<= 1) {
    for (int i = 0; i < m; i += k) {
      for (int j = i + (k >> 1); j < i + k; j++) {
        int s0 = s[j - (k >> 1)], s1 = s[j];
        s[j - (k >> 1)] = qm((s0 + 0ll + s1), zxy) * 1ll * inv2 % zxy;
        s[j] = qm((s0 + 0ll + zxy - s1), zxy) * 1ll * inv2 % zxy;
      }
    }
  }
  return;
}
inline void DWTOR(int *s, int m) {
  for (int k = m; k > 1; k >>= 1) {
    for (int i = 0; i < m; i += k) {
      for (int j = i + (k >> 1); j < i + k; j++) {
        int s0 = s[j - (k >> 1)], s1 = s[j];
        s[j] = qm((s0 + 0ll + s1), zxy);
      }
    }
  }
  return;
}
inline void IDWTOR(int *s, int m) {
  for (int k = 2; k <= m; k <<= 1) {
    for (int i = 0; i < m; i += k) {
      for (int j = i + (k >> 1); j < i + k; j++) {
        int s0 = s[j - (k >> 1)], s1 = s[j];
        s[j] = qm((s1 + 0ll + zxy - s0), zxy);
      }
    }
  }
  return;
}
inline void DWTAND(int *s, int m) {
  for (int k = m; k > 1; k >>= 1) {
    for (int i = 0; i < m; i += k) {
      for (int j = i + (k >> 1); j < i + k; j++) {
        long long s0 = s[j - (k >> 1)], s1 = s[j];
        s[j - (k >> 1)] = qm((s0 + 0ll + s1), zxy);
      }
    }
  }
  return;
}
inline void IDWTAND(int *s, int m) {
  for (int k = 2; k <= m; k <<= 1) {
    for (int i = 0; i < m; i += k) {
      for (int j = i + (k >> 1); j < i + k; j++) {
        int s0 = s[j - (k >> 1)], s1 = s[j];
        s[j - (k >> 1)] = qm((s0 + 0ll + zxy - s1), zxy);
      }
    }
  }
  return;
}
int fb[(1 << 17 | 5)];
int A[23][(1 << 17 | 5)], B[23][(1 << 17 | 5)], AB[23][(1 << 17 | 5)];
int ab[(1 << 17 | 5)];
int C[(1 << 17 | 5)], D[(1 << 17 | 5)], E[(1 << 17 | 5)], DE[(1 << 17 | 5)];
int ct[(1 << 17 | 5)], as[(1 << 17 | 5)];
int main() {
  n = read();
  fb[1] = 1;
  for (int i = 1; i < (1 << 17); i++) {
    ct[i] = ct[i ^ (-(i) & (i))] + 1;
    if (i - 1) fb[i] = qm(fb[i - 2] + 0ll + fb[i - 1], zxy);
  }
  int maxn = 0;
  for (int i = 1; i <= n; i++) {
    s = read();
    maxn = max(maxn, s);
    A[ct[s]][s]++;
    B[ct[s]][s]++;
    C[s]++;
    D[s]++;
    E[s]++;
  }
  n = 0;
  m = 1;
  while (m <= maxn) m <<= 1, n++;
  for (int i = 0; i <= n; i++) {
    DWTOR(A[i], m);
    DWTOR(B[i], m);
  }
  DWTXOR(D, m);
  DWTXOR(E, m);
  for (int i = 0; i < m; i++) DE[i] = D[i] * 1ll * E[i] % zxy;
  IDWTXOR(DE, m);
  for (int i = 0; i <= n; i++) {
    for (int j = 0; j <= i; j++) {
      for (int k = 0; k < m; k++) {
        AB[i][k] =
            qm((AB[i][k] + 0ll + A[j][k] * 1ll * B[i - j][k] % zxy), zxy);
      }
    }
    IDWTOR(AB[i], m);
  }
  for (int i = 0; i < m; i++) {
    ab[i] = AB[ct[i]][i];
    ab[i] = ab[i] * 1ll * fb[i] % zxy;
    C[i] = C[i] * 1ll * fb[i] % zxy;
    DE[i] = DE[i] * 1ll * fb[i] % zxy;
  }
  DWTAND(ab, m);
  DWTAND(C, m);
  DWTAND(DE, m);
  for (int i = 0; i < m; i++) {
    as[i] = ab[i] * 1ll * C[i] % zxy * 1ll * DE[i] % zxy;
  }
  IDWTAND(as, m);
  int ans = 0;
  for (int i = 0; i <= n; i++) {
    ans = qm(ans + 0ll + as[1 << i], zxy);
  }
  printf("%d\n", ans);
  return 0;
}