import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution{ public static void main (String[] args){ Scanner in = new Scanner (System.in); int n = in.nextInt(); int [] arr = new int [n]; int [] count = new int [100]; for (int i=0; i < n; i++){ arr[i] = in.nextInt(); count [--arr[i]]++; } int max=0; for (int i=0; i<99; i++){ int f = count[i]; int s = count[i+1]; if ((f+s)>max) max=(f+s); } System.out.println (max); } }