#include <bits/stdc++.h>
using namespace std;
const int maxn = 3e5 + 10;
int a[maxn];
int cnt[(int)(2e7)];
bool vis[(int)(2e7)];
int Gcd(int a, int b) {
  int temp;
  while (b) {
    temp = b;
    b = a % b;
    a = temp;
  }
  return a;
}
int main() {
  int n;
  scanf("%d", &n);
  int g;
  for (int i = 0; i < n; ++i) {
    scanf("%d", &a[i]);
    if (i) {
      g = Gcd(g, a[i]);
    } else
      g = a[i];
  }
  int mx = 0;
  int ans = -1;
  for (int i = 0; i < n; ++i) {
    ++cnt[mx = max(a[i] / g, mx), a[i] / g];
  }
  for (int i = 2; i <= mx; ++i) {
    if (!vis[i]) {
      int sum = 0;
      for (int j = i; j <= mx; j += i) {
        sum += cnt[j];
        vis[j] = true;
      }
      ans = max(ans, sum);
    }
  }
  printf("%d", ans == -1 ? ans : n - ans);
  return 0;
}
