#!/bin/python3 import sys from collections import Counter, defaultdict, deque N = int(input().strip()) A = [int(a_temp) for a_temp in input().strip().split(' ')] Ac = Counter(A) ans = 0 for a, c in Ac.items(): ans = max(ans, c + Ac[a-1], c + Ac[a+1]) print(ans)