#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("avx")
using namespace std;
long long max(long long a, long long b) {
  if (a > b) {
    return a;
  }
  return b;
}
uint32_t rd() {
  uint32_t res;
  res = std::random_device()();
  return res;
}
vector<long long> v5(15000001);
vector<long long> primeFactors(long long n) {
  vector<long long> ret;
  while (n > 1) {
    ret.push_back(v5[n]);
    n = n / v5[n];
  }
  return ret;
}
long long di(long long a, long long b) {
  if (a % b == 0) {
    return a / b;
  }
  return a / b + 1;
}
long long gcd(long long a, long long b) {
  while (b) {
    a %= b;
    swap(a, b);
  }
  return a;
}
long long i, e, n, m, k, q, a = 0, b = 0, c = 0, j = 0, x = 0, y = 0, z, w,
                            mi = 1001010, mx = -1, sum = 0, f = 0, l, r, hi, lo;
bool t;
string s, s1, s2;
int main() {
  ios::sync_with_stdio(false);
  cin >> n;
  long long v3[n];
  vector<long long> v, v2(15000001);
  v5.clear();
  for (i = 2; i < 15000001; i++) {
    if (v5[i] == 0) {
      for (e = i; e < 15000001; e += i) {
        if (v5[e] == 0) {
          v5[e] = i;
        }
      }
    }
  }
  v2.clear();
  v.clear();
  cin >> v3[0];
  x = v3[0];
  mx = v3[0];
  for (i = 1; i < n; i++) {
    cin >> v3[i];
    x = gcd(x, v3[i]);
    if (v3[i] > mx) {
      mx = v3[i];
    }
  }
  if (x == mx) {
    cout << -1;
    return 0;
  }
  mx = -1;
  for (i = 0; i < n; i++) {
    v3[i] = v3[i] / x;
  }
  for (i = 0; i < n; i++) {
    v.clear();
    v = primeFactors(v3[i]);
    if (v.size() > 0) {
      v2[v[0]]++;
    }
    for (e = 1; e < v.size(); e++) {
      if (v[e] != v[e - 1]) {
        v2[v[e]]++;
      }
    }
  }
  for (i = 0; i < 15000001; i++) {
    if (v2[i] > mx) {
      mx = v2[i];
    }
  }
  cout << n - mx;
}
