Given an array of integers, find and print the maximum number of integers you can select from the array such that the absolute difference between any two of the chosen integers is less or equal to 1.
The first line contains a single integer n (2 ≤ n ≤ 100), denoting the size of the array. The second line contains n integers describing the respective values of a[0]
, a[1]
, ..., a[n-1]
(0 < a[i]
< 100).
Print a single integer denoting the maximum number of integers you can choose from the array such that the absolute difference between any two of the chosen integers is ≤ 1. The answer is ≥ 2.