#P2062. Maximize the Number of Teams

    ID: 15344 Type: Default 1000ms 256MiB

Maximize the Number of Teams

Maximize the Number of Teams

Given n players, partition them into several teams such that each player i requires that the size of their team is at least \(a_i\) (i.e., \(\text{team size} \geq a_i\)). Under this condition, maximize the total number of teams.

Note: Each player belongs to exactly one team.

inputFormat

The input consists of two lines:

  • The first line contains an integer n representing the number of players.
  • The second line contains n space-separated integers \(a_1, a_2, \ldots, a_n\), where \(a_i\) is the minimum team size required by the i-th player.

outputFormat

Output a single integer representing the maximum number of teams that can be formed while satisfying all players' requirements.

sample

1
1
1