#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) {
  if (a < b) swap(a, b);
  if (a % b == 0) return b;
  return gcd(b, a % b);
}
const int MAX = 15 * 1e6 + 1;
int pr[MAX] = {0};
bool prime[MAX];
int sp[MAX];
void isprime() {
  for (int i = 0; i < MAX; i++) prime[i] = true;
  for (int i = 2 * 2; i < MAX; i += 2) {
    prime[i] = false;
  }
  for (int i = 3; i * i < MAX; i += 2) {
    if (prime[i]) {
      for (int j = i * i; j < MAX; j += 2 * i) {
        prime[j] = false;
      }
    }
  }
}
void smallpr() {
  for (int i = 2; i < MAX; i++) {
    sp[i] = i;
  }
  for (int i = 2 * 2; i < MAX; i += 2) {
    sp[i] = 2;
  }
  for (int i = 3; i < MAX; i += 2) {
    if (prime[i]) {
      for (long long j = i * 1LL * i; j < MAX; j += 2 * i) {
        if (sp[j] == j) sp[j] = i;
      }
    }
  }
}
void primeFact(int n) {
  while (n > 1) {
    int tmp = sp[n];
    int j = 0;
    while (n % tmp == 0) {
      if (j == 0) pr[tmp]++;
      j++;
      n /= tmp;
    }
  }
}
int main() {
  isprime();
  smallpr();
  int n;
  cin >> n;
  int a[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  int gcdval = gcd(a[0], a[1]);
  for (int i = 2; i < n; i++) {
    gcdval = gcd(a[i], gcdval);
  }
  for (int i = 0; i < n; i++) a[i] /= gcdval;
  for (int i = 0; i < n; i++) {
    primeFact(a[i]);
  }
  int ans = 0;
  for (int i = 0; i < MAX; i++) {
    ans = max(ans, pr[i]);
  }
  if (ans == 0)
    cout << "-1\n";
  else
    cout << n - ans << endl;
  return 0;
}
