Max GCD


Submit solution

Points: 7
Time limit: 0.6s
Memory limit: 256M

Problem type

Given N integers a_1, a_2, \dots, a_N, you can choose one of them and replace it with an integer of your choice between 1 to 10^9, possibly the same as the original integer you choose.

Find the maximum possible greatest common divisor (GCD) of the N integers after your replace.

Input Specification

The first line contains one integer N, (2 \leq N \leq 10^5), the number of integers.

The second line contains N integers, a_i (1 \leq a_i \leq 10^9).

Output Specification

Output one integer, the maximum possible greatest common divisor (GCD) of the N integers after your replace.

Sample Input 1

3
7 6 8

Sample Output 1

2

Sample Input 2

3
12 15 18

Sample Output 2

6

Sample Input 3

2
10000 10000

Sample Output 3

10000

Explanation for Sample Input 1

You can replace 7 with 8 and the GCD is 2.


Comments

There are no comments at the moment.