#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; };
int n, a[300005], inf, gdk, c[15000005], t = 0x3f7f7f7f;
bool vis[15000005];
int main() {
  ios::sync_with_stdio(false);
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 1; i <= n; i++) gdk = gcd(a[i], gdk);
  for (int i = 1; i <= n; i++) c[a[i] / gdk]++, inf = max(inf, a[i] / gdk);
  for (int i = 2; i <= inf; i++) {
    int h = 0;
    if (!vis[i])
      for (int j = i; j <= inf; j += i) vis[j] = 1, h += c[j];
    t = min(t, n - h);
  }
  (t == 0x3f7f7f7f) ? cout << -1 << endl : cout << t << endl;
  return 0;
}
