Processing math: 100%

Problem K. Kit of gauge blocks

Author:A. Karabanov   Time limit:1 sec
Input file:Standard input   Memory limit:64 Mb
Output file:Standard output  

Statement

When Timofey was cleaning garage of his grandfather, he found a strange box under the workbench. There were ceramic plates of different lengths. His father explained to him that it was a measuring device that allowed you to store and transmit a length. The plates are simply placed against each other (their surfaces are polished to such an extent that they hold on to each other without breaking up) until the desired length is reached. Unfortunately, many plates were lost, so now it's possible to have only a limited set of lengths. Timofey wants to find out what is the longest range of consecutive natural numbers that can be obtained from the remaining plates.

Input format

The first line contains one integer n — the number of available plates. The second line contains n natural numbers xi — space-separated lengths of plates, sorted in non-descending order.

Output format

Print one natural number — length of longest range of consecutive natural numbers that can be obtained from the remaining plates.

Constraints

1n100

1xi1000

Explanation of the sample

In the example you are given five plates with lengths 1, 4, 5, 7 and 15. It's possible to obtain lengths [1], [4 .. 13], [15 .. 17], [19 .. 28], [31 .. 32] ([a .. b] means, that it's possible to obtain any length from a to b inclusive). The longest range has length equal to 10, for example range [4 .. 13] or [19 .. 28].

Sample tests

No. Standard input Standard output
1
5
1 4 5 7 15
10

0.083s 0.008s 15