Ice Cream Boxes

View as PDF

Submit solution


Points: 1
Time limit: 1.0s
Memory limit: 256M

Problem types

Gizem owns an ice cream shop, and she sells \(\mathbf{N}\) ice cream flavors. There is \(\mathbf{A_i}\) kilogram of ice cream from every flavor in Gizem's shop.

Yiit goes to Gizem's shop and wants to buy as many different variaties of ice cream as possible. Yiit can carry any weight of ice cream boxes as he wishes, but the ice cream boxes he carries can only carry equal weights of ice cream, and they should hold at least 2 kilograms. Because Yiit is a bit stingy, he wants to fit the ice cream flavors that he's going to buy into boxes without any remainder, and also, he doesn't want to leave that kind of ice cream to others. Since Yiit is also a bit grumpy, he doesn't want to mix the different flavors. Hence he puts only one type of flavor in each box.

Can you find which size of ice cream box Yiit needs to choose to get the most number of ice cream flavors?

Input

In the first line, \(\mathbf{N}\) ice cream flavors are given.

In the second line, there are \(\mathbf{N}\) integers. \(\mathbf{A_i}\) represents the amount of kilogram of the \(i^{th}\) flavor of ice cream.

  • \(1 \leq \mathbf{N} \leq 1000\)
  • \(2 \leq \mathbf{A_i} \leq 2000\)

Output

Print what size of box Yiit should choose to carry the most number of different ice cream flavors. If you face a case where he can carry with more than one possible box, print the size of the smallest box.

Examples

Input:

5
3 4 5 6 8

Output:

2

Input:

6
3 5 6 9 11 22

Output:

3

Explanations

First Input

If Yiit chooses a box large enough to take 2 kilograms, he can get all of the 2nd, 4th, and 5th ice cream flavors, of which there are 4, 6, 8 many. He can take at most 2 different flavors of ice cream with other boxes of different sizes.

Second Input

If Yiit chooses a box large enough to take 3 kilograms, he can get all of the 1st, 3th, and 4th ice cream flavors, of which there are 3, 6, 9 many. He can take at most 2 different flavors of ice cream with other boxes of different sizes.