#include <bits/stdc++.h>
using namespace std;
int a[300000 + 5], u[15000000 + 5], p[15000000 + 5], pn, s[15000000 + 5];
int gcd(int x, int y) { return y ? gcd(y, x % y) : x; }
int main() {
  int n, i, j, g, x, ans = 0;
  for (i = 2; i <= 15000000; ++i) {
    if (!u[i]) u[i] = p[++pn] = i;
    for (j = 1; i * p[j] <= 15000000; ++j) {
      u[i * p[j]] = p[j];
      if (i % p[j] == 0) break;
    }
  }
  scanf("%d", &n);
  for (g = 0, i = 1; i <= n; ++i) scanf("%d", &a[i]), g = gcd(g, a[i]);
  for (i = 1; i <= n; ++i)
    for (j = a[i] / g; j > 1;)
      for (++s[x = u[j]]; u[j] == x;) j /= u[j];
  for (i = 1; i <= 15000000; ++i) ans = max(ans, s[i]);
  printf("%d", ans ? n - ans : -1);
}
