Mr. F has n positive integers, a_1, a_2, …, a_n.

He thinks the greatest common divisor of these integers is too small. So he wants to enlarge it by removing some of the integers.

But this problem is too simple for him, so he does not want to do it by himself. If you help him, he will give you some scores in reward.

Your task is to calculate the minimum number of integers you need to remove so that the greatest common divisor of the remaining integers is bigger than that of all integers.

Input

The first line contains an integer n (2 ≤ n ≤ 3 ⋅ 10^5) — the number of integers Mr. F has.

The second line contains n integers, a_1, a_2, …, a_n (1 ≤ a_i ≤ 1.5 ⋅ 10^7).

Output

Print an integer — the minimum number of integers you need to remove so that the greatest common divisor of the remaining integers is bigger than that of all integers.

You should not remove all of the integers.

If there is no solution, print «-1» (without quotes).

Examples

Input

3
1 2 4


Output

1

Input

4
6 9 15 30


Output

2

Input

3
1 1 1


Output

-1

Note

In the first example, the greatest common divisor is 1 in the beginning. You can remove 1 so that the greatest common divisor is enlarged to 2. The answer is 1.

In the second example, the greatest common divisor is 3 in the beginning. You can remove 6 and 9 so that the greatest common divisor is enlarged to 15. There is no solution which removes only one integer. So the answer is 2.

In the third example, there is no solution to enlarge the greatest common divisor. So the answer is -1.
import java.util.*;

//Try 1, remove smallest number until gcd increases
//      --> Issue is repeats of smallers numbers where removing 
//          larger one is faster (3 5 7 7 8)
//Try 2, factor all numbers, factor that all have is gcd, next biggest is
// the target
//      --> Issue is that trial division is too slow
//Try 3, replace trial division with sieve factorization
//      --> Timing?
//Try 4 Giving up

public class EnlargeGCD {
    public static void main(String[] args) {
        int factArr[] = new int[15000001];
        factArr = sieve(factArr);
        HashMap<Integer, Integer> ffreq = new HashMap<Integer,Integer>();
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int arr[] = new int[n];
        boolean flag  = false;
        for (int i = 0; i < n;i++) {
            arr[i] = sc.nextInt();
        }
        boolean f = false;
        for (int i = 1; i < n; i++) {
            if (arr[i] != arr[i-1]) {
                f = true;
            }
        }
        if (!f) {
            System.out.println("-1");
            System.exit(0);
        }
        int gcd = arr[0];
        for (int i = 0; i<n; i++) {
            gcd = gcd(gcd, arr[i]);
        }
        for (int i = 0; i<n; i++) {
            arr[i]/=gcd;
        }
        for (int i = 0; i<n; i++) {
            for (Integer fac: getFactors(arr[i], factArr)) {
                Integer temp = ffreq.get(fac);
                if (temp == null) {
                    ffreq.put(fac, 1);
                }
                else { ffreq.put(fac, temp+1);}
            }
        }
        int max = 0;
        for (Integer e : ffreq.values()) {
            if (e>max) {
                max = e;
            }
        }
        
        System.out.println((n-max));
        sc.close();
    
    }
    public static int[] sieve(int[] spf) {
        spf[1] = 1;
        for (int i=2; i<spf.length; i++) spf[i] = i;
        for (int i=4; i<spf.length; i+=2) spf[i] = 2;
        for (int i=3; i*i<spf.length; i++) {
            if (spf[i] == i) {
                for (int j=i*i; j<spf.length; j+=i)
                    if (spf[j]==j) spf[j] = i;
            }
        }
        return spf;
        
    }
    
    public static int gcd(int a, int b) {
        if (b==0) {
            return a;
        }
        else {
            return gcd(b, a%b);
        }
    }
    
    public static LinkedList<Integer> getFactors(int x, int[] spf) {
        LinkedList<Integer> res = new LinkedList<>();
        while (x != 1) {
            if (res.isEmpty()) res.add(spf[x]);
            else if (res.getLast() != spf[x]) res.add(spf[x]);
            x = x / spf[x];
        }
        return res;
    }
    
    
    /*
    public static HashMap<Integer,Integer> factorize(HashMap<Integer, Integer> ffreq, int num, int[] spf) {
        int decNum = num;
        int arr[] = new int[num+1];
        //System.out.println("calling with: " +  num);
        int prevPrime = 0;
        int runF = 1;
        //Need to add the  number itself
        
        Integer x = ffreq.get(num);
        Integer y = ffreq.get(1);
        arr[1] = 1;
        arr[num] = 1;
        if (x == null) {
                ffreq.put(num, 1);
            }
        else {
            ffreq.put(num, x.intValue()+1);
        }
        if (num != 1) {
            if (y == null) {
                ffreq.put(1, 1);
            }
            else {
                ffreq.put(1, y.intValue()+1);
            }
        }
        Integer k = null;
        Integer j = null;
        while (decNum != 1) {
            //Next prime factor
            //if (spf[num] != prevPrime) {
            //    runF = 1;
            //}
            runF *= spf[decNum];
            //Get the running factor
            k = ffreq.get(num/(runF));
            j = ffreq.get(runF);
            if (arr[runF] == 0) {
                arr[runF] = 1;
                arr[num/runF] = 1;
                //System.out.println("NUM: " + num +  ", Factor 1: " + runF + ", Factor 2: " + num/runF);
                if (j == null) {
                    ffreq.put(runF, 1);
                }
                else {
                    ffreq.put(runF, j.intValue()+1);
                    }
                if (runF != num/runF) {
                   if (k == null) {
                        ffreq.put(num/runF, 1);
                    }
                    else {
                        ffreq.put(num/runF, k.intValue()+1);
                    }
                }
            }
            //Get the other one
            k = ffreq.get(num/spf[decNum]);
            j = ffreq.get(spf[decNum]);
            if (arr[spf[decNum]] == 0) {
                arr[spf[decNum]] = 1;
                arr[num/spf[decNum]] = 1;
                //System.out.println("NUM: " + num +  ", Factor 1: " + spf[decNum] + ", Factor 2: " + num/spf[decNum]);
                if (j == null) {
                    ffreq.put(spf[decNum], 1);
                }
                else {
                    ffreq.put(spf[decNum], j.intValue()+1);
                    }
                if (runF != num/spf[decNum]) {
                   if (k == null) {
                        ffreq.put(num/spf[decNum], 1);
                    }
                    else {
                        ffreq.put(num/spf[decNum], k.intValue()+1);
                    }
                }
            }
            
            
            prevPrime = spf[decNum];
            decNum /= spf[decNum];
        }

        return ffreq;
    }*/
}
