User's AC Ratio

96.1% (49/51)

Submission's AC Ratio

29.4% (73/248)

Description

Give you a sequence of integers with length $N$, please find the "mode" of the sequence.

A "mode" of a sequence is the number which appears most often in this sequence.

Input Format

The first line contains a positive integer $N\ (N\leq10^ 5)$ - the length of sequence.
The second line contains $N$ positive integers, the $i_{th}$ number $a_i\ (a_i\leq10^ 5)$ represents the $i_{th}$ element of a sequence.

Output Format

Print the mode of sequence at first line. If there are more than one mode, print all of them and separate each mode by a space. The order of modes does not matter.
Then print how many times the mode appears at second line.

Sample Input 1

10
5 8 4 3 6 9 9 1 3 6

Sample Output 1

3 6 9
2

Hints

Problem Source

Subtasks

No. Testdata Range Constraints Score
1 0~4 $N, a_i\leq3000$, and the answer will be unique 10
2 0~11 The answer will be unique 10
3 0~17 No specified restriction 5

Testdata and Limits

No. Time Limit (ms) Memory Limit (KiB) Output Limit (KiB) Subtasks
0 1000 65536 65536 1 2 3
1 1000 65536 65536 1 2 3
2 1000 65536 65536 1 2 3
3 1000 65536 65536 1 2 3
4 1000 65536 65536 1 2 3
5 1000 65536 65536 2 3
6 1000 65536 65536 2 3
7 1000 65536 65536 2 3
8 1000 65536 65536 2 3
9 1000 65536 65536 2 3
10 1000 65536 65536 2 3
11 1000 65536 65536 2 3
12 1000 65536 65536 3
13 1000 65536 65536 3
14 1000 65536 65536 3
15 1000 65536 65536 3
16 1000 65536 65536 3
17 1000 65536 65536 3