766. Beautiful Array

0

Easy

Given a non-empty array of non-negative integers V, the beautiful array is defined as the maximum frequency of any one of its elements. Your task is to find the length of the smallest possible subarray of V that has the same beauty as V.

Input Format

The first line of the input contains the size of the array, N. The second line contains N space-separated non-negative integers.

Output Format

Print a single integer representing the desired beauty of the array.

Example

Input

5 1 2 2 3 1

Output

2

Constraints

1 <= V.length() <= 50,000
0 <= V[i] <= 49,999
Loading...

View Submissions

Console