#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) {
  while (b != 0) {
    a = a % b;
    swap(a, b);
  }
  return a;
}
const int MX = 15000000;
const int MN = 300000;
int pr[MX + 1], a[MN + 1], s[MX + 1], lp[MX + 1];
int cnt = 0;
void solve() {
  int n, g, x = 0, i, j;
  memset(lp, 0, sizeof lp);
  for (i = 2; i <= MX; ++i) {
    if (!lp[i]) pr[cnt++] = lp[i] = i;
    for (j = 0; j < cnt && i * pr[j] <= MX && pr[j] <= lp[i]; ++j) {
      lp[i * pr[j]] = pr[j];
    }
  }
  lp[1] = 1;
  cin >> n;
  for (g = 0, i = 1; i <= n; ++i) {
    cin >> a[i];
    g = gcd(g, a[i]);
  }
  for (i = 1; i <= n; ++i)
    for (j = a[i] / g; j > 1;) {
      for (x = lp[j], ++s[x]; lp[j] == x;) j /= lp[j];
    }
  int mx = 0;
  for (i = 2; i <= MX; ++i) mx = max(mx, s[i]);
  cout << (mx ? n - mx : -1) << '\n';
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  solve();
  return 0;
}
