#!/bin/python3 import sys n = int(input().strip()) a = [int(a_temp) for a_temp in input().strip().split(' ')] from collections import Counter counter = Counter(a) result = 0 for k, v in counter.items(): tmp = v tmp1, tmp2 = 0, 0 if k-1 in counter: tmp1 = counter[k-1] if k+1 in counter: tmp2 = counter[k+1] tmp += max(tmp1, tmp2) if tmp > result: result = tmp print(result)