using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace hrHourRank44 { class Program { static void Main(string[] args) { Console.ReadLine(); var nums = Console.ReadLine().Split().Select(int.Parse).OrderBy(x => x).ToArray(); var maxCount = 0; for (int i = 0; i < nums.Length; i++) { var curVal = nums[i]; var curLowerCount = nums.Where(x => x == curVal || x == curVal - 1).Count(); var curUpperCount = nums.Where(x => x == curVal || x == curVal + 1).Count(); if (curLowerCount > maxCount) { maxCount = curLowerCount; } if (curUpperCount > maxCount) { maxCount = curUpperCount; } } Console.WriteLine(maxCount); } } }