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;
template <class T>
inline void gmin(T &x, const T &y) {
  x = x > y ? y : x;
}
template <class T>
inline void gmax(T &x, const T &y) {
  x = x < y ? y : x;
}
template <class T>
inline bool Gmin(T &x, const T &y) {
  return x > y ? x = y, 1 : 0;
}
template <class T>
inline bool Gmax(T &x, const T &y) {
  return x < y ? x = y, 1 : 0;
}
const int BufferSize = 1 << 16;
char buffer[BufferSize], *Bufferhead, *Buffertail;
bool Terminal;
inline char Getchar() {
  if (Bufferhead == Buffertail) {
    int l = fread(buffer, 1, BufferSize, stdin);
    if (!l) {
      Terminal = 1;
      return 0;
    }
    Buffertail = (Bufferhead = buffer) + l;
  }
  return *Bufferhead++;
}
template <class T>
inline bool read(T &x) {
  x = 0;
  char c = Getchar(), rev = 0;
  while (c < '0' || c > '9') {
    rev |= c == '-';
    c = Getchar();
    if (Terminal) return 0;
  }
  while (c >= '0' && c <= '9') x = x * 10 + c - '0', c = Getchar();
  if (c == '.') {
    c = Getchar();
    double t = 0.1;
    while (c >= '0' && c <= '9')
      x = x + (c - '0') * t, c = Getchar(), t = t / 10;
  }
  x = rev ? -x : x;
  return 1;
}
template <class T1, class T2>
inline bool read(T1 &x, T2 &y) {
  return read(x) & read(y);
}
template <class T1, class T2, class T3>
inline bool read(T1 &x, T2 &y, T3 &z) {
  return read(x) & read(y) & read(z);
}
template <class T1, class T2, class T3, class T4>
inline bool read(T1 &x, T2 &y, T3 &z, T4 &w) {
  return read(x) & read(y) & read(z) & read(w);
}
inline bool reads(char *x) {
  char c = Getchar();
  while (c < 33 || c > 126) {
    c = Getchar();
    if (Terminal) return 0;
  }
  while (c >= 33 && c <= 126) (*x++) = c, c = Getchar();
  *x = 0;
  return 1;
}
template <class T>
inline void print(T x, const char c = '\n') {
  if (!x) {
    putchar('0');
    putchar(c);
    return;
  }
  if (x < 0) putchar('-'), x = -x;
  int m = 0, a[20];
  while (x) a[m++] = x % 10, x /= 10;
  while (m--) putchar(a[m] + '0');
  putchar(c);
}
const int inf = 0x3f3f3f3f;
const int N = 200005, M = 100005, mod = 1e9 + 7;
template <class T, class S>
inline void ch(T &x, const S y) {
  x = (x + y) % mod;
}
inline int exp(int x, int y, const int mod = ::mod) {
  int ans = 1;
  while (y) {
    if (y & 1) ans = (long long)ans * x % mod;
    x = (long long)x * x % mod;
    y >>= 1;
  }
  return ans;
}
char bits[N];
int n, m, lg, mx, a[N], b[N], c[N], f[N];
inline void fwt(int *a, int l, int r) {
  if (l == r) return;
  int mid = l + r >> 1;
  fwt(a, l, mid);
  fwt(a, mid + 1, r);
  for (int i = l; i <= mid; i++) {
    int y = a[i - l + mid + 1];
    a[i - l + mid + 1] = (a[i] - y) % mod;
    a[i] = (a[i] + y) % mod;
  }
}
inline void s1(int *a, int *b) {
  static int t1[19][N], t2[19][N];
  for (int i = 0; i < m; i++) t1[bits[i]][i] = a[i];
  for (int i = 0; i <= lg; i++) fwt(t1[i], 0, m - 1);
  for (int i = 0; i <= lg; i++)
    for (int j = 0; j <= lg; j++) {
      if (i + j > lg) continue;
      for (int k = 0; k < m; k++)
        ch(t2[i + j][k], (long long)t1[i][k] * t1[j][k]);
    }
  for (int i = 0, inv = exp(m, mod - 2); i <= lg; i++) {
    fwt(t2[i], 0, m - 1);
    for (int j = 0; j < m; j++) t2[i][j] = (long long)t2[i][j] * inv % mod;
  }
  for (int i = 0; i < m; i++) b[i] = t2[bits[i]][i];
}
inline void s2(int *a, int *b) {
  static int tmp[N];
  for (int i = 0; i < m; i++) tmp[i] = a[i];
  fwt(tmp, 0, m - 1);
  for (int i = 0; i < m; i++) tmp[i] = (long long)tmp[i] * tmp[i] % mod;
  fwt(tmp, 0, m - 1);
  for (int i = 0, inv = exp(m, mod - 2); i < m; i++)
    tmp[i] = (long long)tmp[i] * inv % mod;
  for (int i = 0; i < m; i++) b[i] = tmp[i];
}
int main() {
  read(n);
  for (int i = 1; i <= n; i++) {
    int x;
    read(x);
    gmax(mx, x);
    a[x]++;
  }
  m = 1;
  lg = 0;
  while (m <= mx) m <<= 1, lg++;
  for (int i = 1; i < m; i++) bits[i] = bits[i ^ (i & -i)] + 1;
  f[0] = 0;
  f[1] = 1;
  for (int i = 2; i <= m; i++) f[i] = (f[i - 1] + f[i - 2]) % mod;
  s1(a, b);
  s2(a, c);
  for (int i = 0; i < m; i++)
    a[i] = (long long)a[i] * f[i] % mod, b[i] = (long long)b[i] * f[i] % mod,
    c[i] = (long long)c[i] * f[i] % mod;
  for (int i = 0; i < lg; i++)
    for (int j = 0; j < m; j++)
      if (j & (1 << i))
        ch(a[j ^ (1 << i)], a[j]), ch(b[j ^ (1 << i)], b[j]),
            ch(c[j ^ (1 << i)], c[j]);
  for (int i = 0; i < m; i++) a[i] = (long long)a[i] * b[i] % mod * c[i] % mod;
  for (int i = 0; i < lg; i++)
    for (int j = 0; j < m; j++)
      if (j & (1 << i)) ch(a[j ^ (1 << i)], -a[j]);
  int ans = 0;
  for (int i = 0; i < lg; i++) ch(ans, a[1 << i]);
  if (ans < 0) ans += mod;
  printf("%d\n", ans);
  return 0;
}