#include <bits/stdc++.h>
using namespace std;
int n, i, j, a[100010], c[71], d[71], f[2][1 << 19], x, y, t, q;
bool bo;
int main() {
  for (i = 2; i <= 70; i++) {
    bo = 1;
    for (j = 2; j * j <= i; j++)
      if (i % j == 0) {
        bo = 0;
        break;
      }
    if (bo) d[i] = q++;
  }
  scanf("%d", &n);
  a[0] = 1;
  for (i = 1; i <= n; i++) a[i] = a[i - 1] * 2 % 1000000007;
  for (i = 1; i <= n; i++)
    for (i = 1; i <= n; i++) {
      scanf("%d", &x);
      c[x]++;
    }
  f[1][0] = 1ll * a[c[1]] * a[c[4]] % 1000000007 * a[c[9]] % 1000000007 *
            a[c[16]] % 1000000007 * a[c[25]] % 1000000007 * a[c[36]] %
            1000000007 * a[c[49]] % 1000000007 * a[c[64]] % 1000000007;
  for (i = 1; i <= 70; i++, t = !t)
    if (c[i] && i != 1 && i != 4 && i != 9 && i != 16 && i != 25 && i != 36 &&
        i != 49 && i != 64) {
      x = i;
      y = 0;
      for (j = 2; j <= 70; j++)
        while (x % j == 0) {
          y ^= 1 << d[j];
          x /= j;
        }
      for (j = 0; j < 1 << 19; j++)
        f[t][j] = 1ll * (f[!t][j] + f[!t][j ^ y]) * (a[c[i] - 1]) % 1000000007;
    } else
      for (j = 0; j < 1 << 19; j++) f[t][j] = f[!t][j];
  cout << (f[!t][0] - 1 + 1000000007) % 1000000007 << endl;
}
