#include <bits/stdc++.h>
using namespace std;
map<int, int> m;
int gcd(int x, int y) {
  if (y == 0) return x;
  return gcd(y, x % y);
}
int a[300005], n;
int b[5005];
vector<int> p;
int main() {
  for (int i = 2; i <= 5000; i++)
    if (!b[i]) {
      p.push_back(i);
      for (int j = 1; j * i <= 5000; j++) b[j * i] = 1;
    }
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", &a[i]);
  int d = a[0];
  for (int i = 1; i < n; i++) d = gcd(d, a[i]);
  for (int i = 0; i < n; i++) a[i] /= d;
  for (int i = 0; i < n; i++) {
    set<int> s;
    int k = a[i];
    for (int j = 0; j < p.size(); j++) {
      if (k < p[j]) break;
      if (k % p[j]) continue;
      while (k % p[j] == 0) k /= p[j];
      s.insert(p[j]);
    }
    if (k > 1) s.insert(k);
    for (auto it = s.begin(); it != s.end(); it++) m[*it]++;
  }
  int mx = 0;
  for (auto it = m.begin(); it != m.end(); it++) {
    mx = max(mx, it->second);
  }
  int ans = n - mx;
  if (ans == n) ans = -1;
  cout << ans << endl;
}
