D. Grand Voting —— 伟大的投票

    Type: Default 1000ms 256MiB

Grand Voting —— 伟大的投票

You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.

Statement

Timothy organized a contest, but it received heavy downvotes. He decided to start manipulating the comments.

This contest has ss votes, initially set to 0.

There are nn participants, each with a voting parameter aia_i. When it’s their turn to vote:

  • If sais \geqslant a_i, they cast an upvote, incrementing ss by 1;
  • If s<ais < a_i, they cast aa downvote, decrementing ss by 1.

Timothy can control the voting order of these nn people. He wants to know the maximum and minimum possible vote count ss in this contest.

Input

The first line of input contains aa single integer n(1n105)n (1 \leqslant n \leqslant 10^5), representing the number of voters.

The next line of input contains nn integers a1,a2,,an(ai105)a_1, a_2, \cdots , a_n (|a_i| \leqslant 10^5), separated by spaces.

Output

Output one line containing two integers separated by a space, representing the maximum and minimum vote count ss in this contest.

Samples

5
-1 0 1 2 3
5 -5

Note

For example, if you rearrange aa to [1,0,1,2,3][−1, 0, 1, 2, 3], initially s=0s = 0. Since sa1=1s \geqslant a_1 = −1, the first voter casts an upvote, making s=1s = 1. Similarly, the remaining four voters also satisfy sais \leqslant a_i, so all cast upvotes. The final value of ss is 5, which is the maximum possible.

Conversely, if you rearrange aa to [1,2,0,3,1][1, 2, 0, 3, −1], then for each voter from left to right, s<ais < a_i holds, so all cast downvotes, resulting in s=5s = −5. This is the minimum possible. Another arrangement such as [3,2,1,0,1][3, 2, 1, 0, −1] also leads to s=5s = −5.