#!/bin/python import sys n = int(raw_input().strip()) a = map(int,raw_input().strip().split(' ')) a.sort() res = 0 for i in xrange(n): c = 1 for j in xrange(i+1, n): if a[j] - a[i] <= 1: c += 1 res = max(res, c) print res