#include <bits/stdc++.h>
using namespace std;
const int M = 15000101;
const int N = 3e5 + 101;
int n, a[N], maxn;
int cnt[M], prime[M], tot;
bool flag[M];
int gcd(int x, int y) { return y == 0 ? x : gcd(y, x % y); }
void get_prime(int n) {
  flag[1] = 1;
  for (int i = 2; i <= n; i++) {
    if (!flag[i]) prime[++tot] = i;
    for (int j = 1; j <= tot && i * prime[j] <= n; j++) {
      flag[i * prime[j]] = 1;
      if (i % prime[j] == 0) break;
    }
  }
}
signed main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]), maxn = max(maxn, a[i]);
  get_prime(maxn);
  int gc = a[1];
  for (int i = 2; i <= n; i++) gc = gcd(gc, a[i]);
  for (int i = 1; i <= n; i++) a[i] /= gc;
  for (int i = 1; i <= n; i++) ++cnt[a[i]];
  int ans = n;
  for (int z = 1; z <= tot; z++) {
    int i = prime[z];
    int val = 0;
    for (int j = i; j <= maxn; j += i) val += cnt[j];
    ans = min(ans, n - val);
  }
  if (ans == n) ans = -1;
  cout << ans << endl;
}
