#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) {
  if (a == 0) return b;
  return gcd(b % a, a);
}
int spf[15000005], ans[15000002];
void sieve() {
  spf[1] = 1;
  for (int i = 2; i < 15000002; i++) spf[i] = i;
  for (int i = 4; i < 15000002; i += 2) spf[i] = 2;
  for (int i = 3; i * i < 15000002; i++) {
    if (spf[i] == i) {
      for (int j = i * i; j < 15000002; j += i)
        if (spf[j] == j) spf[j] = i;
    }
  }
}
int main() {
  int i, n, ans1 = 1, k = 0;
  scanf("%d", &n);
  int a[300005];
  sieve();
  for (i = 1; i <= n; i++) scanf("%d", &a[i]);
  ans1 = a[1];
  for (i = 1; i <= n; i++) ans1 = gcd(ans1, a[i]);
  for (i = 1; i <= n; i++) a[i] = (a[i] / ans1);
  for (i = 1; i <= n; i++) {
    int x = a[i];
    set<int> q;
    while (x != 1) {
      q.insert(spf[x]);
      x = x / spf[x];
    }
    set<int>::iterator it1;
    for (it1 = q.begin(); it1 != q.end(); ++it1) ans[*it1]++;
  }
  int p = 0;
  for (i = 1; i <= 15000000; i++) p = max(p, ans[i]);
  if (p == 0)
    printf("-1\n");
  else
    printf("%d\n", n - p);
  return 0;
}
