#include <bits/stdc++.h>
#pragma Grem optimize("O3")
using namespace std;
void FastInputOutput() {
  ios_base ::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
inline int D() {
  int t;
  scanf("%d", &t);
  return t;
}
inline long long LLD() {
  long long t;
  scanf("%lld", &t);
  return t;
}
inline long long power(long long x, long long p, long long m) {
  long long res = 1;
  while (p) {
    if (p & 1) res = ((res % m) * (x % m)) % m;
    x = ((x % m) * (x % m)) % m;
    p >>= 1;
  }
  return res % m;
}
long double ModLog(long double base, long double x) {
  return (logl(x) / logl(base));
}
long long gcd(long long a, long long b) {
  if (!b) return a;
  return gcd(b, a % b);
}
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
const long long P = 1e9 + 9;
const int N = 15 * 1e6 + 1, NN = 1e4;
int ans, n;
bool vst[N];
int a[N], fr[N];
void seive() {
  for (int i = 2; i < N; ++i) {
    if (vst[i]) continue;
    int curr = 0;
    for (int j = i; j < N; j += i) {
      vst[j] = 1;
      if (fr[j]) curr += fr[j];
    }
    if (curr) ans = min(ans, n - curr);
  }
}
int main() {
  n = D();
  ans = n;
  int GCD = 0;
  for (int i = 0; i < n; ++i) {
    a[i] = D();
    GCD = gcd(a[i], GCD);
  }
  for (int i = 0; i < n; ++i) {
    int curr = a[i] / GCD;
    ++fr[curr];
  }
  seive();
  printf("%d", ans == n ? -1 : ans);
  return 0;
}
