ORGNZ - Organizator

no tags 

Unexpected problems with law enforcement have convinced Mirko to take up a less lucrative but less morally ambiguous career: he has become the chief organizer of a team computer science contest. There are N CS clubs that wish to participate in the contest. The presidents of the clubs are quite stubborn and will participate in the contest only if the contest team size makes it possible for all club members to participate.

The contest consists of two rounds: qualifications and finals. All teams that are competing must have an equal number of members and all members of one team must belong to the same club. Any number of teams from each club can participate in the qualification round, and the best team from each club earns a spot in the finals.

Mirko is aware that, with a new and unproven contest, he needs publicity. For that reason, he wants to set the team size such that the number of individual participants in the finals is as large as possible. Remember, each club that participates has a right to one team in the finals. Furthermore, at least two clubs must participate in the contest, otherwise the contest would be too boring to attract sponsors. Determine the maximum possible number of participants in the finals so that Mirko can double check his team size choice.

Input

The first line of input contains the positive integer N (2 ≤ N ≤ 200 000), the number of clubs. The second line of input contains N space-separated integers from the interval [1, 2 000 000], the number of members of each club.

Output

The first and only line of output must contain the maximum possible number of finalists.

Example

Input:
3 
1 2 4 

Output:
4
Input:
2 
1 5 

Output:
2

hide comments
nadstratosfer: 2019-07-13 06:35:18

"The best team from each club earns a spot in the finals", but how do the other teams get there? First sample shows a case where max team size = 1, since all teams have an equal amount of members and the first club only has one competitor. That means qualification might feature 7 1-person teams, 3 of which "have right" to finals, but there's another that qualifies somehow. This is not explained. Worse still, SPOJToolkit shows 3 for case 1 2 5. I don't understand how 50+ users got AC in an obviously incomplete problem.


Added by:Tomislav Babic
Date:2013-10-12
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64
Resource:COCI 2013 1. round