#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) {
  if (a < b) swap(a, b);
  if (b == 0) return a;
  return gcd(b, a % b);
}
const int maxn = 2e7;
vector<int> primes;
vector<int> sieve(maxn + 5, 0);
void gen() {
  sieve[0] = sieve[1] = 1;
  for (int i = 2; i < maxn; i++) {
    if (sieve[i]) continue;
    sieve[i] = i;
    primes.push_back(i);
    for (int j = 2; i * j < maxn; j++) {
      if (sieve[i * j]) continue;
      sieve[i * j] = i;
    }
  }
}
int main() {
  std::ios::sync_with_stdio(false);
  cin.tie(NULL);
  gen();
  int n;
  cin >> n;
  vector<int> a(n);
  int g = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    g = gcd(g, a[i]);
  }
  for (int i = 0; i < n; i++) a[i] /= g;
  map<int, int> cnt;
  for (int p : a) {
    while (p != 1) {
      int d = sieve[p];
      cnt[d]++;
      while (p % d == 0) {
        p /= d;
      }
    }
  }
  int ans = n;
  for (auto i : cnt) ans = min(ans, n - i.second);
  cout << (ans == n ? -1 : ans);
  return 0;
}
