시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
1 초 512 MB 1 1 1 100.000%

## 문제

Moris's favorite computer game is called <<Squarow>>. The game starts with a row of colored squares appearing on the screen. The player can choose a color and remove all the squares of that color (you cannot choose a color that is not among the colors of the squares). After removal, all remaining squares are shifted to the left so that there are no empty spaces in the row between adjacent squares. The order of the squares in the row does not change. All squares of the same color, standing in a row one after another, form a \emph {block}. When you remove a selected color, you get the number of points equal to the number of blocks left in the row.

Help Moris find out what is the largest number of blocks he can get after removing the squares of some color, and what color to choose. If there are several such colors, output any of them.

## 입력

The first line contains a single integer $n$ ($1 \le n \le 2 \cdot 10^5$), the number of squares in the row.

The second line contains $n$ integers $a_i$ ($1 \le i \le n$, $1 \le a_i \le 2 \cdot 10^5$), the color of the $i$-th square in the row.

## 출력

In a single line output two integers: the largest number of blocks that can remain after removing all the squares of one chosen color, and the number corresponding to the color that must be removed to achieve such a number of blocks.

## 서브태스크

번호 배점 제한
1 19

$n \le 100$, $a_i \le 100$

2 43

$n \le 10^4$, $a_i \le 10^3$

3 38

$n \le 2 \cdot 10^5$, $a_i \le 2 \cdot 10^5$

## 예제 입력 1

6
1 1 1 2 2 1


## 예제 출력 1

1 1


## 예제 입력 2

12
1 1 2 3 3 3 2 1 1 1 2 2


## 예제 출력 2

4 3


## 예제 입력 3

15
4 5 5 4 4 4 5 9 9 5 5 5 5 9 9


## 예제 출력 3

4 4


## 힌트

In the first example, if you remove color 1, one block of color 2 will remain, and if you remove color 2, there will be one block of color 1 (since the blocks on opposite sides of the block of color 2 will merge into one block).

In the second example, if you remove color 1, there will be three blocks, if you remove color 2, there will be also three blocks, and if you remove color 3, then 4 blocks will remain.

In the third example: for color 4 : 4 blocks, for color 5 : 2 blocks, for color 9 : 4 blocks.

## 채점 및 기타 정보

• 예제는 채점하지 않는다.