#include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 10;
const int M = 1.5e7 + 10;
int a[N];
int mp[M];
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
bool isprime[M];
vector<int> primes;
void getprime() {
  memset(isprime, 1, sizeof isprime);
  for (int i = 2; i < M; i++) {
    if (isprime[i]) primes.push_back(i);
    for (int j = 0; j < primes.size() && i * primes[j] < M; j++) {
      isprime[primes[j] * i] = 0;
      if (i % primes[j] == 0) break;
    }
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  int g = 0;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    g = gcd(g, a[i]);
  }
  for (int i = 1; i <= n; i++) {
    a[i] /= g;
    mp[a[i]]++;
  }
  getprime();
  int mx = 0;
  for (auto p : primes) {
    int cnt = 0;
    for (int i = p; i < M; i += p) cnt += mp[i];
    mx = max(mx, cnt);
  }
  cout << (mx ? n - mx : -1) << endl;
  return 0;
}
