4350 - 많이 나타난 정수

Time Limit: 1s Memory Limit: 128MB

Submissions: 1320 Solved: 508
Description

N개의 정수를 입력으로 받아, 가장 많이 나타난 정수와 그 개수를 출력하는 프로그램을 작성하세요. 만약  3 5 2 5 5 5을 입력으로 받는다면 가장 많이 나타난 정수는 5이고 그 개수는 4입니다.

Write a program that reads integers, finds the most frequent number of them, and counts its occurrences. Suppose that you entered 3 5 2 5 5 5; the program finds that the most frequent number is 5 and the occurrence count for 5 is 4.

 

Input

* Line 1 : 정수의 개수 N (1~1,000)

* Line 2 ~ N+1 : 정수(-1,000,000,000 ~ 1,000,000,000)

 

Output

* Line 1 : 가장 많은 정수(중복되는 경우 없다고 가정 ex. 가장 많은 정수의 개수가 n일때 x도 n번 y도 n번 나오는 경우 없음)

* Line 2 : 가장 많은 정수의 개수

 

Sample Input
6
3
5
2
5
5
5
Sample Output
5
4
Source

JAVA2015 PE5.41