import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { static int localmax = 0; static int answer = 0; public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] a = new int[n]; int[] b = new int[n]; for(int a_i=0; a_i < n; a_i++){ a[a_i] = sc.nextInt(); b[a_i] = 0; } Arrays.sort(a); for(int i = 0; i< n; i++){ for(int j = i; j < n; j++){ if (a[j] <= a[i] + 1){ localmax++; } } answer = Math.max(localmax, answer); localmax = 0; } System.out.println(answer); } }