#include <bits/stdc++.h>
using namespace std;
int dizi[600005];
int asal_[15000005];
int cnt[15000005];
int gccd(int a, int b) {
  if (b == 0)
    return a;
  else
    return gccd(b, a % b);
}
int main() {
  int x = 15000001;
  for (int i = 2; i < x; i++) {
    if (asal_[i] == 0) {
      for (int j = i; j < x; j += i) {
        if (asal_[j] == 0) asal_[j] = i;
      }
    }
  }
  int n;
  scanf("%d", &n);
  int g = 0;
  for (int i = 0; i < n; i++) {
    scanf("%d", dizi + i);
    g = gccd(g, dizi[i]);
  }
  for (int i = 0; i < n; i++) {
    int j = dizi[i] / g;
    for (; j > 1;) {
      int x = asal_[j];
      while (j % x == 0) j /= x;
      cnt[x]++;
    }
  }
  int max_say = 0;
  for (int i = 2; i < 15000005; i++) max_say = max(max_say, cnt[i]);
  if (max_say == 0)
    cout << "-1";
  else
    cout << n - max_say;
  return 0;
}
