output_description: Print the maximum possible number of i such that a_i=X.
  
  * * *
input_description: The input is given from Standard Input in the following format:
  
      
      
      N
      a_1 a_2 .. a_N
attempt: # -*- coding: utf-8 -*-
  import sys
  import math
  import os
  import itertools
  import string
  import heapq
  from _collections import defaultdict
  from functools import lru_cache
  
  
  class Scanner:
      def int():
          return int(sys.stdin.readline().rstrip())
  
      def string():
          return sys.stdin.readline().rstrip()
  
      def map_int():
          return [int(x) for x in Scanner.string().split()]
  
      def string_list(n):
          return [input() for i in range(n)]
  
      def int_list_list(n):
          return [Scanner.mapInt() for i in range(n)]
  
      def int_cols_list(n):
          return [int(input()) for i in range(n)]
  
  
  class Math:
      def gcd(a, b):
          if b == 0:
              return a
          return Math.gcd(b, a % b)
  
      def lcm(a, b):
          return (a * b) // Math.gcd(a, b)
  
      def roundUp(a, b):
          return -(-a // b)
  
      def toUpperMultiple(a, x):
          return Math.roundUp(a, x) * x
  
      def toLowerMultiple(a, x):
          return (a // x) * x
  
      def nearPow2(n):
          if n <= 0:
              return 0
          if n & (n - 1) == 0:
              return n
          ret = 1
          while n > 0:
              ret <<= 1
              n >>= 1
          return ret
  
      def isPrime(n):
          if n < 2:
              return False
          if n == 2:
              return True
          if n % 2 == 0:
              return False
          d = int(n**0.5) + 1
          for i in range(3, d + 1, 2):
              if n % i == 0:
                  return False
          return True
  
  
  MOD = int(1e09) + 7
  
  
  def main():
      N = Scanner.int()
      A = Scanner.map_int()
      M = defaultdict(int)
      for i in range(N):
          M[A[i]] += 1
          M[A[i] + 1] += 1
          M[A[i] - 1] += 1
      ans = 0
      for v in M.values():
          ans = max(ans, v)
      print(ans)
      return
  
  
  if __name__ == "__main__":
      main()
  
problem_description: Statement
  
  You are given an integer sequence of length N, a_1,a_2,...,a_N.
  
  For each 1≤i≤N, you have three choices: add 1 to a_i, subtract 1 from a_i or
  do nothing.
  
  After these operations, you select an integer X and count the number of i such
  that a_i=X.
  
  Maximize this count by making optimal choices.
samples: [{"input": "7\n    3 1 4 1 5 9 2", "output": "4\n    \n\nFor example, turn the sequence into 2,2,3,2,6,9,2 and select X=2 to obtain 4,\nthe maximum possible count.\n\n* * *"}, {"input": "10\n    0 1 2 3 4 5 6 7 8 9", "output": "3\n    \n\n* * *"}, {"input": "1\n    99999", "output": "1"}]