#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) {
  if (b == 0) {
    return a;
  }
  return gcd(b, a % b);
}
int a[300005];
bool notprime[8000005];
map<int, int> prims;
vector<int> primes;
void factor(int num) {
  for (int i = 0; i < primes.size() && primes[i] * primes[i] <= num; i++) {
    if (num % primes[i] == 0) {
      prims[primes[i]]++;
      while (num % primes[i] == 0) {
        num /= primes[i];
      }
      if (num == 1) {
        break;
      }
    }
  }
  if (num != 1) prims[num]++;
}
int main() {
  std::ios_base::sync_with_stdio(false);
  notprime[0] = true;
  notprime[1] = true;
  int i;
  for (i = 2; i * i <= 8000005; i++) {
    if (!notprime[i]) {
      primes.push_back(i);
      for (int j = i * i; j < 8000005; j += i) {
        notprime[j] = true;
      }
    }
  }
  for (; i < 8000005; i++) {
    if (!notprime[i]) primes.push_back(i);
  }
  int n;
  cin >> n;
  int commgcd;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    if (i == 0)
      commgcd = a[i];
    else
      commgcd = gcd(a[i], commgcd);
  }
  for (int i = 0; i < n; i++) {
    factor(a[i] / commgcd);
  }
  int maxprim = -1;
  for (auto par : prims) {
    if (par.second > maxprim) {
      maxprim = par.second;
    }
  }
  if (maxprim == -1)
    cout << -1 << endl;
  else
    cout << n - maxprim << endl;
}
