using System; using System.Collections.Generic; using System.IO; using System.Linq; class Solution { static void Main(String[] args) { int n = Convert.ToInt32(Console.ReadLine()); string[] a_temp = Console.ReadLine().Split(' '); int[] a = Array.ConvertAll(a_temp, Int32.Parse); Array.Sort(a); int result = 0; for (int x = n - 1; x >= 0; x--) { int temp = 1; for (int y = 0; y < x; y++) { if (a[x] - a[y] <= 1) temp++; } result = Math.Max(result, temp); } Console.WriteLine(result); } }