import java.util.*; public class Solution2 { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int[] a = new int[n]; for (int a_i = 0; a_i < n; a_i++) { a[a_i] = in.nextInt(); } Arrays.sort(a); int count = 0, temp = 0; for (int i = 0; i < n; i++) { temp = 0; for (int j = i; j < n; j++) { if (a[j] - a[i] <= 1) temp++; } if (temp > count) count = temp; } System.out.println(count); } }