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 k=0; int max=0, maxI=0;; for(int a_i=0; a_i < n; a_i++){ a[a_i] = in.nextInt(); if(a[a_i]>max) max =a[a_i]; } List iList = new ArrayList<>(); for (int i : a) { iList.add(i); } int iCount=0; for(int i=1;i<=max;i++){ iCount = Collections.frequency(iList, i); if(Collections.frequency(iList, i-1)>0) iCount=iCount + Collections.frequency(iList, i-1); //System.out.println(i+ " " + iCount); if(iCount>maxI) maxI=iCount; } //for(int j=0;i