CF757B.Bash's Big Day

普及/提高-

通过率:0%

AC君温馨提醒

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

题目描述

Bash has set out on a journey to become the greatest Pokemon master. To get his first Pokemon, he went to Professor Zulu's Lab. Since Bash is Professor Zulu's favourite student, Zulu allows him to take as many Pokemon from his lab as he pleases.

But Zulu warns him that a group of k>1 Pokemon with strengths s1,s2,s3,...,sk{s_{1},s_{2},s_{3},...,s_{k}} tend to fight among each other if gcd(s1,s2,s3,...,sk)=1gcd(s_{1},s_{2},s_{3},...,s_{k})=1 (see notes for gcdgcd definition).

Bash, being smart, does not want his Pokemon to fight among each other. However, he also wants to maximize the number of Pokemon he takes from the lab. Can you help Bash find out the maximum number of Pokemon he can take?

Note: A Pokemon cannot fight with itself.

输入格式

The input consists of two lines.

The first line contains an integer nn ( 1<=n<=1051<=n<=10^{5} ), the number of Pokemon in the lab.

The next line contains nn space separated integers, where the ii -th of them denotes sis_{i} ( 1<=si<=1051<=s_{i}<=10^{5} ), the strength of the ii -th Pokemon.

输出格式

Print single integer — the maximum number of Pokemons Bash can take.

输入输出样例

  • 输入#1

    3
    2 3 4
    

    输出#1

    2
    
  • 输入#2

    5
    2 3 4 6 7
    

    输出#2

    3
    

说明/提示

gcdgcd (greatest common divisor) of positive integers set a1,a2,...,an{a_{1},a_{2},...,a_{n}} is the maximum positive integer that divides all the integers a1,a2,...,an{a_{1},a_{2},...,a_{n}} .

In the first sample, we can take Pokemons with strengths 2,4{2,4} since gcd(2,4)=2gcd(2,4)=2 .

In the second sample, we can take Pokemons with strengths 2,4,6{2,4,6} , and there is no larger group with gcd1gcd≠1 .

首页