#include <bits/stdc++.h>   using namespace std;   long long gcd(long long a, long long b) {     if (a < b)       return gcd(b, a);     else if (b == 0)       return a;     else       return gcd(b, a % b);   }   long long pow(long long b, long long e) {     if (e == 0)       return 1;     else if (e % 2 == 0) {       long long a = pow(b, e / 2);       return a * a;     } else {       long long a = pow(b, e / 2);       return b * a * a;     }   }   long long powm(long long x, long long y, long long m = 1000000007) {     x = x % m;     long long res = 1;     while (y) {       if (y & 1) res = res * x;       res %= m;       y = y >> 1;       x = x * x;       x %= m;     }     return res;   }   long long lcm(long long a, long long b) { return (a * b) / gcd(a, b); }   long long modInverse(long long a, long long m) { return powm(a, m - 2, m); }   bool issq(long long n) {     long long p = sqrt(n);     return p * p == n;   }   long long MIN(long long a = 2e18, long long b = 2e18, long long c = 2e18,                 long long d = 2e18, long long e = 2e18) {     return min(a, min(b, min(c, min(d, e))));   }   long long MAX(long long a = -2e18, long long b = -2e18, long long c = -2e18,                 long long d = -2e18, long long e = -2e18) {     return max(a, max(b, max(c, max(d, e))));   }   vector<int> prime;   void seive(long long n) {     prime.resize(n + 5, 0);     long long j;     for (long long i = 2; i <= n; i++) {       if (!prime[i]) {         prime[i] = i;         for (j = i * i; j <= n; j += i)           if (!prime[j]) prime[j] = i;       }     }   }   long long extended_GCD(long long a, long long b, long long &x, long long &y) {     if (a == 0) {       x = 0;       y = 1;       return b;     }     long long x1, y1;     long long gcd = extended_GCD(b % a, a, x1, y1);     x = y1 - (b / a) * x1;     y = x1;     return gcd;   }   long long mulInv(long long a, long long mod) {     long long x, y;     extended_GCD(a, mod, x, y);     if (x < 0) x += mod;     return x;   }   void __print(int x) { cout << x; }   void __print(long x) { cout << x; }   void __print(long long x) { cout << x; }   void __print(unsigned x) { cout << x; }   void __print(unsigned long x) { cout << x; }   void __print(unsigned long long x) { cout << x; }   void __print(float x) { cout << x; }   void __print(double x) { cout << x; }   void __print(long double x) { cout << x; }   void __print(char x) { cout <<     << x <<    ; }   void __print(const char *x) { cout <<     << x <<    ; }   void __print(const string &x) { cout <<     << x <<    ; }   void __print(bool x) { cout << (x ?  true  :  false ); }   template <typename T, typename V>   void __print(const pair<T, V> &x) {     cout <<  { ;     __print(x.first);     cout <<  , ;     __print(x.second);     cout <<  } ;   }   template <typename T>   void __print(const T &x) {     int f = 0;     cout <<  { ;     for (auto &i : x) cout << (f++ ?  ,  :   ), __print(i);     cout <<  } ;   }   void _print() { cout <<  ] n ; }   template <typename T, typename... V>   void _print(T t, V... v) {     __print(t);     if (sizeof...(v)) cout <<  ,  ;     _print(v...);   }   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     ;     long long n;     cin >> n;     long long a[n + 1];     long long f = 0;     for (long long i = 1; i <= n; i++) {       cin >> a[i];       if (a[1] != a[i]) f = 1;     }     if (f == 0)       cout << -1;     else {       long long d = 15e6;       seive(d);       long long hcf = a[1];       for (long long i = 2; i <= n; i++) hcf = gcd(hcf, a[i]);       map<long long, long long> mp;       for (long long i = 1; i <= n; i++) {         a[i] = a[i] / hcf;         long long x = a[i];         while (x != 1) {           long long p = prime[x];           mp[p]++;           while (x % p == 0) x /= p;         }       }       long long ans = 0;       for (auto x : mp) ans = max(ans, x.second);       cout << n - ans;       cout <<   n ;     }     return 0;   }   