#include <bits/stdc++.h>
using namespace std;
namespace Final {
int f[1 << 17 | 1], g[1 << 17 | 1], h[1 << 17 | 1];
}
int c[17 + 1][1 << 17 | 1], v[17 + 1][1 << 17 | 1];
int f[1 << 17 | 1], g[1 << 17 | 1];
int k[1 << 17 | 1];
void FWT(int *f, int n, int w) {
  int i, j, l;
  int k;
  for (l = 0; (1 << l) < n; l++)
    for (i = 0; i < n; i += 1 << (l + 1))
      for (j = 0; j < (1 << l); j++)
        if (w == 1 || w == -1)
          f[i + j] = (f[i + j] + w * f[i + j + (1 << l)]) % 1000000007;
        else if (w == 2 || w == -2)
          f[i + j + (1 << l)] =
              (f[i + j + (1 << l)] + (w < 0 ? -1 : 1) * f[i + j]) % 1000000007;
        else {
          k = f[i + j];
          f[i + j] = (f[i + j] + f[i + j + (1 << l)]) % 1000000007;
          f[i + j + (1 << l)] = (k - f[i + j + (1 << l)]) % 1000000007;
          if (w < 0) {
            f[i + j] = (long long)f[i + j] * 500000004 % 1000000007;
            f[i + j + (1 << l)] =
                (long long)f[i + j + (1 << l)] * 500000004 % 1000000007;
          }
        }
  return;
}
int main(void) {
  int n, x;
  int i, j, t;
  for (i = 1; i < (1 << 17); i++) k[i] = k[i & (i - 1)] + 1;
  scanf("%d", &n);
  while (n--) {
    scanf("%d", &x);
    c[k[x]][x]++;
  }
  for (i = 2, f[1] = 1; i < (1 << 17); i++)
    f[i] = (f[i - 1] + f[i - 2]) % 1000000007;
  for (i = 0; i < (1 << 17); i++) {
    g[i] = c[k[i]][i];
    Final::g[i] = (long long)c[k[i]][i] * f[i] % 1000000007;
  }
  FWT(g, 1 << 17, 3);
  for (i = 0; i < (1 << 17); i++) g[i] = (long long)g[i] * g[i] % 1000000007;
  FWT(g, 1 << 17, -3);
  for (i = 0; i < (1 << 17); i++)
    Final::h[i] = (long long)g[i] * f[i] % 1000000007;
  for (i = 0; i <= 17; i++) FWT(c[i], 1 << 17, 2);
  for (i = 1; i <= 17; i++)
    for (j = 0; j <= i; j++)
      for (t = 0; t < (1 << 17); t++)
        v[i][t] = (v[i][t] + (long long)c[j][t] * c[i - j][t] % 1000000007) %
                  1000000007;
  for (i = 0; i <= 17; i++) FWT(v[i], 1 << 17, -2);
  for (i = 0; i < (1 << 17); i++)
    Final::f[i] = (long long)v[k[i]][i] * f[i] % 1000000007;
  FWT(Final::f, 1 << 17, 1);
  FWT(Final::g, 1 << 17, 1);
  FWT(Final::h, 1 << 17, 1);
  for (i = 0; i < (1 << 17); i++)
    Final::f[i] = (long long)Final::f[i] * Final::g[i] % 1000000007 *
                  Final::h[i] % 1000000007;
  FWT(Final::f, 1 << 17, -1);
  for (i = t = 0; i < 17; i++) t = (t + Final::f[1 << i]) % 1000000007;
  printf("%d\n", (t + 1000000007) % 1000000007);
  return 0;
}
