#C13214. Longest Consecutive Sequence
Longest Consecutive Sequence
Longest Consecutive Sequence
Given an array of integers, find the length of the longest sequence of consecutive integers. The sequence can be formed by reordering the unique elements of the array; in other words, duplicates are ignored when forming the sequence.
For example, if the input array is [4, 2, 1, 6, 5], the longest consecutive sequence is [4, 5, 6] which has a length of 3.
inputFormat
The first line of input contains an integer n, representing the number of elements in the array. The second line contains n space-separated integers.
outputFormat
Output a single integer representing the length of the longest consecutive sequence in the array.
## sample0
0