#include <bits/stdc++.h> 
using namespace std;
const int N=1e5+5;
int c[N]={0};
//int flag[N]={0};
int main(){
	int n;
	cin >> n;
	while(n--){
		int a;
		cin >> a;
		c[a-1]++;
		c[a+1]++;
		c[a]++;
	}
	int max=c[0];
	for(int i=1;i<100001;i++){
		if(max<c[i]) max=c[i];
	}
	cout << max << endl;
}