#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int INF = 2147483647;
const int p[] = {2,  3,  5,  7,  11, 13, 17, 19, 23, 29,
                 31, 37, 41, 43, 47, 53, 59, 61, 67};
long long a[100][32], b[100][32];
int main() {
  int n;
  scanf("%d", &n);
  a[0][0] = 1;
  for (int i = 4; i < 19; i++) a[p[i]][0] = 1;
  for (int i = 0; i < n; i++) {
    int x;
    scanf("%d", &x);
    int y = 0;
    for (int j = 0; j < 4; j++)
      if (x % p[j] == 0) {
        int flag = 0;
        while (x % p[j] == 0) flag ^= 1, x /= p[j];
        y += (flag << j);
      }
    if (x > 1) {
      y += 16;
      for (int j = 0; j < 32; j++) b[x][j] = 0;
      for (int j = 0; j < 32; j++) b[x][j ^ y] = (b[x][j ^ y] + a[x][j]) % mod;
      for (int j = 0; j < 32; j++) a[x][j] = (a[x][j] + b[x][j]) % mod;
    } else {
      for (int j = 0; j < 16; j++) b[0][j] = 0;
      for (int j = 0; j < 16; j++) b[0][j ^ y] = (b[0][j ^ y] + a[0][j]) % mod;
      for (int j = 0; j < 16; j++) a[0][j] = (a[0][j] + b[0][j]) % mod;
    }
  }
  for (int i = 4; i < 19; i++) {
    a[p[i]][0] = (a[p[i]][0] + mod - 1) % mod;
    for (int j = 0; j < 16; j++) b[0][j] = 0;
    for (int j = 0; j < 16; j++)
      for (int k = 0; k < 16; k++)
        b[0][j ^ k] = (b[0][j ^ k] + a[0][j] * a[p[i]][k]) % mod;
    for (int j = 0; j < 16; j++) a[0][j] = (a[0][j] + b[0][j]) % mod;
  }
  printf("%lld\n", (a[0][0] + mod - 1) % mod);
  return 0;
}
