#include <bits/stdc++.h>
using namespace std;
const int MAXN = 3e5 + 3;
int minP[MAXN], n;
vector<int> prime;
void pp() {
  for (int i = 1; i < MAXN; i++) minP[i] = i;
  for (int i = 2; i * i <= 4000; i++) {
    for (int j = i; j <= 4000; j += i) {
      if (minP[j] == j) {
        minP[j] = min(minP[j], i);
      }
    }
  }
  for (int i = 2; i <= 4000; i++) {
    if (minP[i] == i) prime.push_back(i);
  }
}
int value[MAXN];
int gcd(int a, int b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n;
  pp();
  for (int i = 1; i <= n; i++) {
    cin >> value[i];
  }
  int g = value[1];
  for (int i = 2; i <= n; i++) {
    g = gcd(g, value[i]);
  }
  for (int i = 1; i <= n; i++) value[i] /= g;
  map<int, int> cnt;
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j < prime.size(); j++) {
      int p = 0;
      while (value[i] % prime[j] == 0) {
        value[i] /= prime[j];
        p = 1;
      }
      if (p) cnt[prime[j]]++;
      if (value[i] == 1) break;
    }
    if (value[i] != 1) cnt[value[i]]++;
  }
  int mx = 0;
  for (auto it = cnt.begin(); it != cnt.end(); it++) {
    mx = max(mx, it->second);
  }
  if (mx == 0) {
    cout << -1;
    exit(0);
  }
  cout << n - mx;
  return 0;
}
