#include <bits/stdc++.h>
using namespace std;
long long i, j, cnt = 0;
int ini[300005];
int ar[15000050] = {0};
int vis[15000050] = {0};
int pr[15000050];
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
int main() {
  int n, g = 0;
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> ini[i];
    g = gcd(g, ini[i]);
  }
  for (i = 0; i < n; i++) {
    ar[ini[i] / g]++;
  }
  for (i = 2; i < 15000001; i++) {
    if (!vis[i]) pr[cnt++] = i;
    for (j = 0; pr[j] * i < 15000001; j++) {
      vis[i * pr[j]] = 1;
      if (i % pr[j] == 0) break;
    }
  }
  long long cur = 0, ans = 0;
  for (i = 0; i < cnt; i++) {
    for (cur = 0, j = pr[i]; j <= 15000001; j += pr[i]) {
      cur += ar[j];
    }
    ans = max(ans, cur);
  }
  if (ans != 0)
    cout << n - ans << '\n';
  else
    cout << -1 << '\n';
}
