#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long lp[15000001], c[15000001];
void sieve() {
  long long i, j;
  for (i = 2; i < 15000001; i++) lp[i] = i;
  for (i = 2; i * i < 15000001; i++)
    if (lp[i] == i)
      for (j = i * i; j < 15000001; j += i) lp[j] = min(lp[j], i);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n;
  sieve();
  cin >> n;
  long long i, a[n];
  for (i = 0; i < n; i++) cin >> a[i];
  long long g = 0;
  for (i = 0; i < n; i++) g = gcd(a[i], g);
  for (i = 0; i < n; i++) a[i] = a[i] / g;
  for (i = 0; i < n; i++) {
    int t = a[i];
    while (t > 1) {
      int lo = lp[t];
      while (t % lo == 0) t /= lo;
      c[lo]++;
    }
  }
  long long ans = INT_MAX;
  for (i = 1; i < 15000001; i++)
    if (c[i]) ans = min(ans, n - c[i]);
  if (ans == INT_MAX)
    cout << -1 << endl;
  else
    cout << ans << endl;
}
