#include <bits/stdc++.h>
using namespace std;
int s[400000];
int su[400000];
int m[20000000];
bool used[20000000];
int gcd(int a, int b) {
  if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}
int max(int a, int b) { return a > b ? a : b; }
int main() {
  int n;
  int tm = 0;
  cin >> n;
  for (int i = 0; i < n; i++) {
    scanf("%d", &s[i]);
  }
  int t = s[0];
  for (int i = 1; i < n; i++) {
    t = gcd(t, s[i]);
  }
  for (int i = 0; i < n; i++) {
    s[i] /= t;
    tm = max(tm, s[i]);
  }
  sort(s, s + n);
  for (int i = n - 1; i >= 0; i--) {
    m[s[i]]++;
  }
  int flag = 0;
  int ans = 0;
  int tmp;
  if (s[0] == s[n - 1]) flag = 1;
  if (flag == 1)
    cout << -1 << endl;
  else {
    for (int i = 2; i < 20000000; i++) {
      if (used[i]) continue;
      tmp = m[i];
      for (int k = 2; (long long)i * k < 20000000LL; k++) {
        used[i * k] = true;
        tmp += m[i * k];
      }
      ans = max(ans, tmp);
    }
    if (ans == 0) {
      cout << -1 << endl;
    } else
      cout << n - ans << endl;
  }
  return 0;
}
