You are given an array of elements. You are required to find the interval that is the most interesting.
We measure the value of interest of an interval as the product between and , where is the frequency of the rarest element in the interval and is the frequency of the most common element. So, for the array we choose and for the interval .
Input
The first line of the input will contain the integer ().
The second line of the input will contain integers separated by space representing the values of the array (the values will be between and ).
For of the points, .
Output
The output will contain only one integer representing the highest value asked in the statement.
Example
stdin
5
1 2 1 3 2
stdout
2
Explanation
In the sample you may choose the intervals , or ; all of them have the rarest occurence of once ( appears once in the interval ) and the most common occurence of twice ( appears twice in the interval ).
Finally, .