아직 만들고 있는 페이지입니다.

이 페이지는 아직 만드는 중입니다. 보이는 내용은 바뀔 수 있습니다.

Taste in Art

시간 제한8초메모리 제한256 MB

요약
서로 다른 양의 정수들 중에서 k, 2k, 3k 형태의 세 수가 하나도 포함되지 않도록 가장 큰 부분집합을 골라 그 크기를 구한다.
난이도

보통10점 중 7점

유형
그리디, 조합론, 정렬, 해시맵
정답자
아직 제출이 없습니다

문제

Maggie has a large collection of modern paintings. She is particularly proud of those depicting colourful squares -- each painting having a different number of squares. She intends to finally make an exhibition of the paintings for her friends, but their sublime tastes require special handling. Maggie knows that if among the presented paintings there are three depicting k,2kk, 2k and 3k3k squares, for some kk, then the whole exhibition will be perceived as predictable, thus dull, thus a failure. If no such a kk exists, the event will be a great success. On the other hand, Maggie wants to show (off) as many paintings as possible. She spends hours on trying to choose the largest possible number of paintings, yet avoiding a predictability. Help her in this task.

입력

The first line of the input contains a single integer nn (1≤n≤50,0001 \le n \le 50\\,000), denoting  the  number of  paintings  with squares in Maggie's collection. In the second and last line of the input there is a sequence of nn pairwise distinct integers a_ia\_i (1≤a_i≤1091 \le a\_i \le 10^9), each separated by a single space, denoting the number of squares on each of paintings in order.

출력

You should write a single integer in the first and only line of the output -- the largest possible number of Maggie's paintings with squares that can form a non-predictable exhibition.

힌트

In the Sample 1, the three paintings form a predictable exhibition, but any two of them do not.

In the Sample 2, the largest set of paintings that form an unpredictable exhibition includes all paintings except the second one.

예제2

  1. 예제 1

    입력
    3
    6 9 3
    
    예상 출력
    2
    
  2. 예제 2

    입력
    6
    1 2 3 4 5 6
    
    예상 출력
    5