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>
#pragma GCC target("avx")
#pragma GCC optimize(3)
#pragma GCC optimize("Ofast")
#pragma GCC optimize("inline")
#pragma GCC optimize("-fgcse")
#pragma GCC optimize("-fgcse-lm")
#pragma GCC optimize("-fipa-sra")
#pragma GCC optimize("-ftree-pre")
#pragma GCC optimize("-ftree-vrp")
#pragma GCC optimize("-fpeephole2")
#pragma GCC optimize("-ffast-math")
#pragma GCC optimize("-fsched-spec")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("-falign-jumps")
#pragma GCC optimize("-falign-loops")
#pragma GCC optimize("-falign-labels")
#pragma GCC optimize("-fdevirtualize")
#pragma GCC optimize("-fcaller-saves")
#pragma GCC optimize("-fcrossjumping")
#pragma GCC optimize("-fthread-jumps")
#pragma GCC optimize("-funroll-loops")
#pragma GCC optimize("-fwhole-program")
#pragma GCC optimize("-freorder-blocks")
#pragma GCC optimize("-fschedule-insns")
#pragma GCC optimize("inline-functions")
#pragma GCC optimize("-ftree-tail-merge")
#pragma GCC optimize("-fschedule-insns2")
#pragma GCC optimize("-fstrict-aliasing")
#pragma GCC optimize("-fstrict-overflow")
#pragma GCC optimize("-falign-functions")
#pragma GCC optimize("-fcse-skip-blocks")
#pragma GCC optimize("-fcse-follow-jumps")
#pragma GCC optimize("-fsched-interblock")
#pragma GCC optimize("-fpartial-inlining")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("-freorder-functions")
#pragma GCC optimize("-findirect-inlining")
#pragma GCC optimize("-fhoist-adjacent-loads")
#pragma GCC optimize("-frerun-cse-after-loop")
#pragma GCC optimize("inline-small-functions")
#pragma GCC optimize("-finline-small-functions")
#pragma GCC optimize("-ftree-switch-conversion")
#pragma GCC optimize("-foptimize-sibling-calls")
#pragma GCC optimize("-fexpensive-optimizations")
#pragma GCC optimize("-funsafe-loop-optimizations")
#pragma GCC optimize("inline-functions-called-once")
#pragma GCC optimize("-fdelete-null-pointer-checks")
using namespace std;
void U(int &x, int y) {
  x += y;
  if (x >= 1000000007) x -= 1000000007;
}
struct D {
  int v[132000];
} a, c, fb;
inline void doit(int &x, int &y, int ty) {
  static int xx, yy;
  switch (ty) {
    case 1:
      xx = x, yy = y, U(xx, yy);
      break;
    case 2:
      xx = x, yy = y, U(yy, xx);
      break;
    case 3:
      xx = yy = x, U(xx, y), U(yy, 1000000007 - y);
      break;
    case -1:
      xx = x, yy = y, U(xx, 1000000007 - yy);
      break;
    case -2:
      xx = x, yy = y, U(yy, 1000000007 - xx);
      break;
    case -3:
      xx = (1000000007 + 1ll) / 2 * (x + y) % 1000000007,
      yy = (1000000007 + 1ll) / 2 * (x + 1000000007 - y) % 1000000007;
      break;
  }
  x = xx;
  y = yy;
}
D tf(D &a, int ty) {
  for (int len = 1; len < 1 << 17; len <<= 1)
    for (int i = 0; i < 1 << 17; i += len * 2) {
      int *l = a.v + i, *r = a.v + i + len;
      for (int j = 0; j < len; ++j) doit(l[j], r[j], ty);
    }
  return a;
}
D operator*(D a, D b) {
  for (int i = 0; i < 1 << 17; ++i)
    a.v[i] = (long long)a.v[i] * b.v[i] % 1000000007;
  return a;
}
D operator&(D a, D b) {
  tf(a, 1), tf(b, 1), a = a * b, tf(a, -1);
  return a;
}
D operator|(D a, D b) {
  tf(a, 2), tf(b, 2), a = a * b, tf(a, -2);
  return a;
}
D operator^(D a, D b) {
  tf(a, 3), tf(b, 3), a = a * b, tf(a, -3);
  return a;
}
int n, x, ans;
int main() {
  scanf("%d", &n);
  for (int i = n; i--;) scanf("%d", &x), ++c.v[x];
  for (int i = 0; i < 1 << 17; ++i)
    for (int j = i; j < 1 << 17; j = j + 1 | i)
      U(a.v[j], (long long)c.v[i] * c.v[j ^ i] % 1000000007);
  fb.v[0] = 0, fb.v[1] = 1;
  for (int i = 2; i < 1 << 17; ++i)
    fb.v[i] = (fb.v[i - 1] + fb.v[i - 2]) % 1000000007;
  a = (a * fb) & (c * fb) & ((c ^ c) * fb);
  for (int i = 1; i < 1 << 17; i <<= 1) U(ans, a.v[i]);
  cout << ans << endl;
}