Question
The Postal Facility's Longest Run

A postal sorting facility scans N package tracking numbers, A_1, A_2, ..., A_N, in no particular order (duplicates may occur among them).

Find the length of the longest run of consecutive integers that all appear somewhere among the scanned tracking numbers (the run itself does not need to appear in any particular order in the input; only every value in some consecutive integer range needs to be present at least once).

Input

The first line contains a single integer KaTeX can only parse string typed expression — the number of tracking numbers scanned. If KaTeX can only parse string typed expression, none were scanned.

The second line contains KaTeX can only parse string typed expression integers KaTeX can only parse string typed expression.

Output

Print a single integer — the length of the longest run of consecutive integers present among the scanned numbers.

Example
Example 1:
Input
6

100 4 200 1 3 2
Output
4
Explanation
The numbers KaTeX can only parse string typed expression are all present, forming a consecutive run of length 4. KaTeX can only parse string typed expression and KaTeX can only parse string typed expression are isolated.

Example 2:
Input
4

100 200 300 400
Output
1
Explanation
None of these numbers are consecutive to each other, so the longest run is just a single number, length 1.

Example 3:
Input
5

5 5 5 5 5
Output
1
Explanation
Every scanned number is the same value, so the longest consecutive run is still just length 1 (duplicates don't extend a run).

Online