#include <bits/stdc++.h>
using namespace std;
int n, m;
int ans = 0;
vector<int> vec, v;
int main() {
  int a, b, c;
  cin >> n;
  for (long long i = (0); i < (n); i++) {
    cin >> a;
    vec.push_back(a);
    v.push_back(0);
  }
  sort((vec).begin(), (vec).end());
  b = vec[0];
  for (long long i = (1); i < (vec.size()); i++) {
    if (b + 2 >= vec[i]) {
      c++;
      v[c - 1] = c;
    } else {
      c = 0;
      b = vec[i];
    }
  }
  sort((v).begin(), (v).end(), greater<int>());
  cout << v[0] + 1 << endl;
  return 0;
}
