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[] a = new int[n]; int[] count = new int[100]; int item; for(int a_i=0; a_i < n; a_i++){ item = in.nextInt(); a[a_i] = item; count[item]++; } int max = count[1] + count[2]; for(int i=2;i<99;i++) { int val = count[i] + count[i+1]; max = (val>max)?val:max; } System.out.println(max); } }