Problem

16 /21


The longest chain

Problem

Write a program that finds the longest chain of identical elements in the initial array of numbers. Output the element that the given string consists of and the length of this string. If the array has several chains of maximum length, you need to display the data for the first one.

Input
The first line contains the size of the N array. The second line contains space-separated N numbers – array elements. It is guaranteed that 3 < N ≤ 10000.

Imprint
Print the element of the searched string and the length of this string.
 
Examples
# Input Output
1 7
1 2 2 1 1 1 3
1 3