#!/bin/python3 import sys import itertools n = int(input().strip()) a = [int(a_temp) for a_temp in input().strip().split(' ')] s=set() for i in range(2,len(a)+1): s.update(list(itertools.combinations(a,i))) l2=[] cp=0 for j in s: c=0 for k in list(itertools.combinations(j,2)): if(abs(k[0]-k[1])<=1): c+=1 if(c>cp): x=len(j) cp=c print(x)