#include<stdio.h>
int main(void){
  char *s="python3 -c\""
"input();a=[0]*100000\n"
"for i in input().split():a[int(i)]+=1\n"
"print(max(map(sum,zip(a,a[1:],a[2:]))))\n"
"\"";
  system(s);
  return 0;
}            