#include <bits/stdc++.h>
using namespace std;
const int max4 = 10004;
const int maxx = 100005;
const int max6 = 1000006;
const int lg5 = 17;
const int INF = 2 * 1000000007;
const long long INFLL = 4LL * 1000000000 * 1000000000;
int powmod(int a, int b, int mod) {
  int res = 1;
  a %= mod;
  for (; b; b >>= 1) {
    if (b & 1) {
      res = 1LL * res * a % mod;
    }
    a = 1LL * a * a % mod;
  }
  return res;
}
int gcd(int a, int b) {
  while (b > 0) {
    int t = a % b;
    a = b, b = t;
  }
  return a;
}
int lcm(int a, int b) { return (a / gcd(a, b)) * b; }
int is_prime(int n) {
  if (n <= 1 || n > 3 && (n % 2 == 0 || n % 3 == 0)) return 0;
  for (int i = 5, t = 2; i * i <= n; i += t, t = 6 - t)
    if (n % i == 0) return 0;
  return 1;
}
const int N = 15000001;
int arr[3 * maxx], cnt[N];
int prime[N];
int main() {
  ios_base ::sync_with_stdio(0);
  cin.tie(0), cout.tie(0);
  for (int i = 2; i * i < N; i++) {
    if (!prime[i]) {
      for (int j = i * i; j < N; j += i) {
        prime[j] = i;
      }
    }
  }
  for (int i = 1; i < N; i++) {
    if (!prime[i]) {
      prime[i] = i;
    }
  }
  int n;
  cin >> n;
  int g = 0;
  for (int i = 1; i <= n; i++) {
    cin >> arr[i];
    g = gcd(g, arr[i]);
  }
  for (int i = 1; i <= n; i++) {
    arr[i] /= g;
  }
  int res = 0;
  for (int i = 1; i <= n; i++) {
    int x = arr[i];
    while (x > 1) {
      int d = prime[x];
      cnt[d]++;
      res = max(res, cnt[d]);
      while (x % d == 0) x /= d;
    }
  }
  cout << (res == 0 ? -1 : n - res) << '\n';
  return 0;
}
