#include <bits/stdc++.h>
using namespace std;
int fx[] = {1, -1, 0, 0};
int fy[] = {0, 0, 1, -1};
template <class T>
inline T power(T p, T e) {
  long long ret = 1;
  for (; e > 0; e >>= 1) {
    if (e & 1) ret = (ret * p);
    p = (p * p);
  }
  return (T)ret;
}
template <class T>
inline T bigmod(T p, T e, T M) {
  long long ret = 1;
  for (; e > 0; e >>= 1) {
    if (e & 1) ret = (ret * p) % M;
    p = (p * p) % M;
  }
  return (T)ret;
}
template <class T>
inline T modinverse(T a, T M) {
  return bigmod(a, M - 2, M);
}
template <class T>
inline T gcd(T a, T b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
struct Sorter {
  int fs, sc;
};
bool cmp(Sorter A, Sorter B) {
  if (A.fs == B.sc) return A.sc < B.sc;
  return A.fs < B.fs;
}
int toInt(string s) {
  int sm;
  stringstream second(s);
  second >> sm;
  return sm;
}
int toLlint(string s) {
  long long int sm;
  stringstream second(s);
  second >> sm;
  return sm;
}
vector<int> prime;
int arr[400000];
bool mark[20000009];
int cum[20000009];
int solve() {
  int n = 15000000;
  int mx = 0;
  for (int i = 2; i <= n; i++) {
    if (!mark[i]) {
      int cnt = 0;
      for (int j = i; j <= n; j += i) {
        mark[j] = 1;
        cnt += cum[j];
      }
      mx = max(mx, cnt);
    }
  }
  return mx;
}
int main() {
  int n;
  scanf("%d", &n);
  int G = 0;
  for (long long i = 0; i < n; i++) {
    scanf("%d", &arr[i + 1]);
    G = gcd(G, arr[i + 1]);
  }
  for (long long i = 1; i < n + 1; i++) {
    cum[arr[i] / G]++;
  }
  int ans = 0;
  ans = solve();
  if (ans) {
    cout << n - ans << endl;
  } else
    cout << -1 << endl;
  return 0;
}
