#include <iostream>
#include <algorithm>
using namespace std;

const int N = 1e5 + 2;
int arr[N];

int main()
{
 int n, t, mx = 0;
 cin >> n;
 for (int i = 0 ; i < n; ++i)
 {
   cin >> t;
   t++;
   arr[t - 1]++;
   arr[t]++;
   arr[t + 1]++;
 }
 for(int x : arr)
   mx = max(mx, x);
  cout << mx;
}