#include <bits/stdc++.h>
using namespace std;
inline long long read() {
  long long x = 0, f = 1;
  char ch = getchar();
  while (ch > '9' || ch < '0') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = (x << 3) + (x << 1) + (ch ^ 48);
    ch = getchar();
  }
  return x * f;
}
inline void write(long long x) {
  if (x < 0) {
    x = -x;
    putchar('-');
  }
  if (x > 9) write(x / 10);
  putchar(x % 10 + '0');
}
inline long long fstmod(long long n, long long m, long long p) {
  long long ans = 1;
  while (m) {
    if (m & 1) {
      ans = ans * n % p;
    }
    n = n * n % p;
    m >>= 1;
  }
  return ans;
}
long long prime[20] = {0,  2,  3,  5,  7,  11, 13, 17, 19, 23,
                       29, 31, 37, 41, 43, 47, 53, 59, 61, 67};
long long base[75];
const long long mod = 1e9 + 7;
signed main() {
  cin.tie(NULL);
  cout.tie(NULL);
  long long n = read(), a = 0;
  long long ans = 0;
  for (register long long i = 1; i <= n; i++) {
    a = read();
    long long b = 0;
    for (register long long j = 1; j <= 19; j++) {
      while (a % prime[j] == 0) {
        b ^= 1ll;
        a /= prime[j];
      }
      b <<= 1;
    }
    for (register long long k = 63; ~k; k--) {
      if (b >> k & 1ull) {
        if (base[k]) {
          b ^= base[k];
        } else {
          base[k] = b;
          ans++;
          break;
        }
      }
    }
  }
  write(fstmod(2, n - ans, mod) - 1);
  return 0;
}
