#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;

const int MAXN = 100 + 5;

int n, a[MAXN], cnt[MAXN], ans;

int main() {
    /* Enter your code here. Read input from STDIN. Print output to STDOUT */ 
    cin >> n;
    for (int i = 0; i < n; i++) cin >> a[i], cnt[a[i]]++;
    for (int i = 0; i + 1 < MAXN; i++)
        ans = max(ans, cnt[i] + cnt[i + 1]);
    cout << ans << endl;
    return 0;
}