#include <bits/stdc++.h>
using namespace std;
int n, a[300010], cnt[15000010], g, mx = 0;
bool vis[15000010];
int gcd(int x, int y) { return y == 0 ? x : gcd(y, x % y); }
int main() {
  scanf("%d%d", &n, &a[1]);
  g = a[1];
  for (int i = 2; i <= n; i++) {
    scanf("%d", &a[i]);
    g = gcd(g, a[i]);
  }
  for (int i = 1; i <= n; i++) {
    a[i] /= g;
    cnt[a[i]]++;
  }
  for (int i = 2; i <= 15000000; i++) {
    if (vis[i]) continue;
    int sum = 0;
    for (int j = i; j <= 15000000; j += i) {
      vis[j] = true;
      sum += cnt[j];
    }
    mx = max(mx, sum);
  }
  printf("%d", (mx == 0 ? -1 : n - mx));
  return 0;
}
