URI Online Judge | 2556

CEI's Reopening

By Ricardo Oliveira, UFPR BR Brazil

Timelimit: 1

To celebrate the reopening of the Clube de Espanhóis Inteligentes (CEI), a big party is happening there at this moment!

Mateuz is one of CEI members, and he is helping with the organization of the party. Everytime a guest arrives or leaves the party, Mateuz writes down on a paper how many minutes have passed since the beggining of the party until that moment.

Mateuz just handed the numbers he wrote to CEI’s presidents, Freitaz and Rodriguez. Notice that the presidents have only got the minutes in wich the guests arrived and left the party. That way, for every given minute, Freitaz and Rodriguez can’t know if the guest was arriving or leaving at the moment. It is only known that: the party started without any guests; until this moment, nobody arrived at the party more than once; and, at this exactly moment, there are no guests at the party, that is, all of the guests already left (because they are going to participate in a programming competition, but intend on going back to the party later). All the numbers he wrote are different from each other, but are not necessarily in order.

Your task is to help Freitaz and Rodriguez to determine the largest possible number of guests that could have been at the pary simultaniously at some moment. Also, determine the longest time (in munutes) in which the largest number of guests could have been at the party simultaniously.


The input contains several test cases. For each test case, the first line contains the integer N (2 ≤ N ≤ 1000), the amount of written numbers. Second line contains N distinct integers m1,m2,...,mN, the numbers wrote down by Mateuz and given to Freitaz and Rodriguez. For each 1 ≤ iN, the number mi (1 ≤ mi ≤ 104) indicates a guest arrived or left the party mi minutes after it began.

The input ends with end-of-file (EOF).


For each test case, print a single line with two integers, separated by a space. The first one is the lagest possible number of guests that could have simultaniously been at the party. The second is the longest time (in minutes) that number of guests could have been at the party simultaniously.

Input Sample Output Sample

1 2
7 3 8 1

1 1
2 4