12393 - Ugly Number   

Description

Let's define beauty of an array element x to be number of array elements which are multiples(倍數) of x - number of array elements which are divisors(因數) of x.

The ugliest element in an array is the one with the least beauty.

For example, given an array { 4, 8, 7, 14 } :

  • For the first element 4, it has 2 multiples (4, 8) and 1 divisor (4) in the array. Therefore its beauty is 2-1=1.

  • For the second element 8, it has 1 multiple (8) and 2 divisor (4, 8) in the array. Therefore its beauty is 1-2=-1.

  • For the third element 7, it has 2 multiples (7, 14) and 1 divisor (7) in the array. Therefore its beauty is 2-1=1.

  • For the fourth element 14, it has 1 multiple (14) and 2 divisors (7, 14) in the array. Therefore its beauty is 1-2=-1.

The second element 8 and the fourth element 14 has the least beauty, so 8 and 14 are the ugliest elements in the array, in which 8 is the smallest of all ugliest elements.

Given an array consist of integers, please output the smallest ugliest element.

Input

The first line of the input contains an integer n, begin the size of the given array. The second line of the input contains n integers, begin the given array.

  • 1 <= n <= 1000

  • 1 <= array elements <= 100000

Output

Output the ugliest element of the given array. Remember to add a '\n' in the end.

Sample Input  Download

Sample Output  Download

Tags




Discuss