#include<iostream>
#include<algorithm>
using namespace std;
const int N = 1e5 + 10;
int a[N];
int main()
{
	int n;
	cin >> n;
	while(n--){
		int x;
		cin >> x;
		a[x-1]++;
		a[x]++;
		a[x+1]++;
	}
	int max = 0;
	for(int i=0;i<N;i++)
		if(a[i]>max)
			max = a[i];
	cout << max << endl;
}