#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4")
using namespace std;
const int inf = 1e9 + 10, lg = 17, size = 1 << lg, M = 1e9 + 7;
const int AND[2][4] = {{0, 1, 1, 1}, {-1, 1, 1, 0}};
const int OR[2][4] = {{1, 1, 1, 0}, {0, 1, 1, -1}};
const int XOR[2][4] = {{1, 1, 1, -1}, {1, 1, 1, -1}};
int n, cnt[4][size], cor[lg + 1][size], cbit[size];
int tmp[size];
int power(int a, int b) {
  int ans = 1;
  while (b > 0) {
    if (b & 1) {
      ans = 1ll * ans * a % M;
    }
    a = 1ll * a * a % M;
    b >>= 1;
  }
  return ans;
}
void transform(int A[], const int z[2][4], bool inv) {
  int a, b;
  for (int len = 1; len < size; len <<= 1) {
    for (int i = 0; i < size; i += (len << 1)) {
      for (int j = i; j < i + len; j++) {
        a = A[j], b = A[j + len];
        A[j] = a * z[inv][0] + b * z[inv][1];
        if (A[j] < 0) {
          A[j] += M;
        }
        if (A[j] >= M) {
          A[j] -= M;
        }
        A[j + len] = a * z[inv][2] + b * z[inv][3];
        if (A[j + len] < 0) {
          A[j + len] += M;
        }
        if (A[j + len] >= M) {
          A[j + len] -= M;
        }
      }
    }
  }
  if (inv && z == XOR) {
    int sinv = power(size, M - 2);
    for (int i = 0; i < size; i++) {
      A[i] = 1ll * A[i] * sinv % M;
    }
  }
}
void or_conv0(int A[]) {
  for (int len = 1; len < size; len <<= 1) {
    for (int i = 0; i < size; i += (len << 1)) {
      for (int j = i; j < i + len; j++) {
        int a = A[j];
        A[j] = a + A[j + len];
        if (A[j] >= M) {
          A[j] -= M;
        }
        A[j + len] = a;
      }
    }
  }
}
void or_conv1(int A[]) {
  for (int len = 1; len < size; len <<= 1) {
    for (int i = 0; i < size; i += (len << 1)) {
      for (int j = i; j < i + len; j++) {
        int a = A[j];
        A[j] = A[j + len];
        A[j + len] = a - A[j + len];
        if (A[j + len] < 0) {
          A[j + len] += M;
        }
      }
    }
  }
}
int fib[size];
int32_t main() {
  fib[1] = 1;
  for (int i = 2; i < size; i++) {
    fib[i] = (fib[i - 1] + fib[i - 2]) % M;
  }
  for (int i = 0; i < size; i++) {
    cbit[i] = cbit[i >> 1] + (i & 1);
  }
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    int a;
    scanf("%d", &a);
    cor[cbit[a]][a]++;
    cnt[1][a]++;
    cnt[2][a]++;
  }
  transform(cnt[2], XOR, 0);
  for (int i = 0; i < size; i++) {
    cnt[2][i] = power(cnt[2][i], 2);
  }
  transform(cnt[2], XOR, 1);
  for (int i = 0; i < lg + 1; i++) {
    or_conv0(cor[i]);
  }
  for (int j = 0; j < lg + 1; j++) {
    for (int k = j; k < lg - j + 1; k++) {
      for (int i = 0; i < size; i++) {
        tmp[i] = 1ll * cor[j][i] * cor[k][i] % M;
      }
      or_conv1(tmp);
      for (int i = 0; i < size; i++) {
        if (cbit[i] == j + k) {
          cnt[0][i] = (cnt[0][i] + tmp[i]) % M;
          if (j != k) {
            cnt[0][i] = (cnt[0][i] + tmp[i]) % M;
          }
        }
      }
    }
  }
  for (int j = 0; j < 3; j++) {
    for (int i = 0; i < size; i++) {
      cnt[j][i] = 1ll * fib[i] * cnt[j][i] % M;
    }
    transform(cnt[j], AND, 0);
  }
  for (int i = 0; i < size; i++) {
    cnt[3][i] = 1ll * cnt[0][i] * cnt[1][i] % M;
    cnt[3][i] = 1ll * cnt[2][i] * cnt[3][i] % M;
  }
  transform(cnt[3], AND, 1);
  int ans = 0;
  for (int i = 0; i < lg; i++) {
    ans = (ans + cnt[3][1 << i]) % M;
  }
  printf("%d\n", ans);
}
