#ARC148A. [ARC148A] mod M

[ARC148A] mod M

Score : 300300 points

Problem Statement

You are given a sequence A=(A1,A2,...,AN)A = (A_1, A_2, ..., A_N). You may perform the following operation exactly once.

  • Choose an integer MM at least 22. Then, for every integer ii (1iN1 \leq i \leq N), replace AiA_i with the remainder when AiA_i is divided by MM.

For instance, if M=4M = 4 is chosen when A=(2,7,4)A = (2, 7, 4), AA becomes (2mod4,7mod4,4mod4)=(2,3,0)(2 \bmod 4, 7 \bmod 4, 4 \bmod 4) = (2, 3, 0).

Find the minimum possible number of different elements in AA after the operation.

Constraints

  • 2N2×1052 \leq N \leq 2 \times 10^5
  • 0Ai1090 \leq A_i \leq 10^9
  • All values in the input are integers.

Input

The input is given from Standard Input in the following format:

NN

A1A_1 A2A_2 \dots ANA_N

Output

Print the answer.

3
1 4 8
2

If you choose M=3M = 3, you will have A=(1mod3,4mod3,8mod3)=(1,1,2)A = (1 \bmod 3, 4 \bmod 3, 8 \bmod 3) = (1, 1, 2), where AA contains two different elements. The number of different elements in AA cannot become 11, so the answer is 22.

4
5 10 15 20
1

If you choose M=5M = 5, you will have A=(0,0,0,0)A = (0, 0, 0, 0), which is optimal.

10
3785 5176 10740 7744 3999 3143 9028 2822 4748 6888
1