#include <bits/stdc++.h>
using namespace std;
bool isPrime[15000005];
int prime[1000000];
int ar[300050] = {0};
int br[15000005] = {0};
int sp[1000000] = {0};
int sieve(int n) {
  int cnt = 0;
  for (int i = 2; i <= n; i++) {
    if (!isPrime[i]) {
      prime[cnt++] = i;
    }
    for (int j = 0; j < cnt && i * prime[j] <= n; j++) {
      isPrime[i * prime[j]] = 1;
      if (i % prime[j] == 0) {
        break;
      }
    }
  }
  return cnt;
}
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int main() {
  int cnt = sieve(15000000), n, a, gcv = 0;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> ar[i];
    gcv = gcd(ar[i], gcv);
  }
  for (int i = 0; i < n; i++) {
    br[ar[i] / gcv]++;
  }
  for (int i = 0; i < cnt; i++) {
    for (int j = prime[i]; j <= 15000000; j += prime[i]) {
      if (br[j]) sp[i] += br[j];
    }
  }
  sort(sp, sp + cnt, greater<int>());
  if (sp[0])
    cout << n - sp[0] << endl;
  else
    cout << -1 << endl;
  return 0;
}
