import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; public class Solution implements Runnable { private void solve() throws IOException { int[] cnt = new int[101]; int N = nextInt(); for(int i = 0; i < N; ++i) { cnt[nextInt()]++; } int best = 0; for(int i = 0; i < 100; ++i) { best = Math.max(best,cnt[i] + cnt[i+1]); } writer.println(best); } public static void main(String[] args) { new Solution().run(); } BufferedReader reader; // BufferedReader reader2; StringTokenizer tokenizer; PrintWriter writer; // BufferedWriter writer; public void run() { try { reader = new BufferedReader(new InputStreamReader(System.in)); // reader = new BufferedReader(new FileReader("trees.in")); // reader2 = new BufferedReader(new FileReader("1.in")); tokenizer = null; writer = new PrintWriter(System.out); // writer = new PrintWriter("trees.out"); // writer = new BufferedWriter(System.out); // writer = new BufferedWriter(new OutputStreamWriter(System.out)); solve(); reader.close(); // reader2.close(); writer.close(); } catch (Exception e) { e.printStackTrace(); System.exit(1); } } int nextInt() throws IOException { return Integer.parseInt(nextToken()); } long nextLong() throws IOException { return Long.parseLong(nextToken()); } double nextDouble() throws IOException { return Double.parseDouble(nextToken()); } short nextShort() throws IOException { return Short.parseShort(nextToken()); } String nextToken() throws IOException { while (tokenizer == null || !tokenizer.hasMoreTokens()) { tokenizer = new StringTokenizer(reader.readLine()); } return tokenizer.nextToken(); } }