Codeforces Round 213 (Div. 1)
D
Ghd
Codeforces
2900
原题
← CE →
翻译中…

John 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*$.

翻译中…

样例

Input #1
6
6 2 3 4 5 6
Output #1
3
InputCopy OutputCopy
Input #2
5
5 5 6 10 15
Output #2
5
InputCopy OutputCopy
题目信息
题号
364D
时间限制
4 s
内存限制
256 MB
标签
暴力
数学
概率论

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。