AdvancedRating 1800
Split Into Runs of Three or More
The sorted list must be split into runs of consecutive integers (like 3 4 5), each of length at least 3, using every number exactly once. Print YES or NO.
Input
n, then n sorted integers.
Output
YES or NO.
Sample 1
Input
6 1 2 3 3 4 5
Output
YES
Sample 2
Input
8 1 2 3 3 4 4 5 5
Output
YES
Output appears here