Codeforces Round 213 (Div. 1) |
---|

Finished |

Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests.
If you've seen these problems, a virtual contest is not for you - solve these problems in the archive.
If you just want to solve some problem from a contest, a virtual contest is not for you - solve this problem in the archive.
Never use someone else's code, read the tutorials or communicate with other person during a virtual contest.

brute force

math

probabilities

*2900

No tag edit access

The problem statement has recently been changed. View the changes.

×
D. Ghd

time limit per test

4 secondsmemory limit per test

256 megabytesinput

standard inputoutput

standard outputJohn Doe offered his sister Jane Doe find the gcd of some set of numbers *a*.

Gcd is a positive integer *g*, such that all number from the set are evenly divisible by *g* and there isn't such *g*' (*g*' > *g*), that all numbers of the set are evenly divisible by *g*'.

Unfortunately Jane couldn't cope with the task and John offered her to find the ghd of the same subset of numbers.

Ghd is a positive integer *g*, such that at least half of numbers from the set are evenly divisible by *g* and there isn't such *g*' (*g*' > *g*) that at least half of the numbers from the set are evenly divisible by *g*'.

Jane coped with the task for two hours. Please try it, too.

Input

The first line contains an integer *n* (1 ≤ *n* ≤ 10^{6}) showing how many numbers are in set *a*. The second line contains space-separated integers *a*_{1}, *a*_{2}, ..., *a*_{n} (1 ≤ *a*_{i} ≤ 10^{12}). Please note, that given set can contain equal numbers.

Please, do not write the %lld specifier to read or write 64-bit integers in С++. It is preferred to use the %I64d specifier.

Output

Print a single integer *g* — the Ghd of set *a*.

Examples

Input

6

6 2 3 4 5 6

Output

3

Input

5

5 5 6 10 15

Output

5

Codeforces (c) Copyright 2010-2024 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Apr/21/2024 01:55:37 (h1).

Desktop version, switch to mobile version.

Supported by

User lists

Name |
---|