CF364D.Ghd

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

John Doe offered his sister Jane Doe find the gcd of some set of numbers aa .

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

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 gg , such that at least half of numbers from the set are evenly divisible by gg and there isn't such gg' (g>g)(g'>g) that at least half of the numbers from the set are evenly divisible by gg' .

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

输入格式

The first line contains an integer nn ( 1<=n<=1061<=n<=10^{6} ) showing how many numbers are in set aa . The second line contains space-separated integers a1,a2,...,ana_{1},a_{2},...,a_{n} (1<=ai<=1012)(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.

输出格式

Print a single integer gg — the Ghd of set aa .

输入输出样例

  • 输入#1

    6
    6 2 3 4 5 6
    

    输出#1

    3
    
  • 输入#2

    5
    5 5 6 10 15
    

    输出#2

    5
    
首页