PivotOJ

Breeding Bugs

시간 제한: 1000ms메모리 제한: 1024MB출처: GCPC 2022BOJ 26012

문제

This year is a good year for North America. 2022 is one of the few years where no brood of the periodical cicada is hatching and thus, no swarms will destroy the crops on the fields.

Those periodical cicadas have a somewhat strange property: They have highly synchronized life cycles, which means that almost all individuals in a local population emerge in the same year, resulting in periodical cicada plagues. Even odder is the fact that the periodicities of those life cycles appear to be prime, for example 13 or 17 years. The best theory for this so far is that a prime periodicity lets them avoid predators with shorter population cycles since a brood emergence of cicadas will rarely coincide with a predator's population boost.

But nobody likes cicada plagues, so this prime periodicity is now your problem. Your hope is that cicadas with non-prime periodicity will not be able to avoid predators anymore and that there will be fewer cicada plagues as a result. So, to prevent the next plague, you forge a plan to breed different cicada types to get a new type with non-prime periodicity. If you mate a cicada of a type with periodicity aa with another cicada of a type with periodicity bb, you assume to get a cicada of a type with periodicity a+ba+b. You have already captured nn cicadas to breed but you don't know which will mate. Therefore, you decided to set some cicadas free such that the remaining ones can mate this year in any way they want without producing a cicada of a type with prime periodicity. How many of your cicadas can you keep at most?

입력

The input consists of:

  • One line with a single integer nn (1n<7501\leq n<750), the number of cicadas.
  • One line with nn integers p1,,pnp_1, \ldots, p_n (1pi<1071\leq p_i<10^7), where pip_i denotes the periodicity of the iith cicada.

출력

Output a single integer, the maximum number of cicadas you can keep.

예제

예제 1

입력
8
1 2 3 4 5 6 7 8
출력
4

예제 2

입력
5
7 13 2 2 4
출력
4
코드를 제출하려면 로그인하세요.