#include #define F first #define S second #define mp make_pair #define pb push_back #define sz(x) x.size() #define all(x) x.begin(), x.end() #define pii pair < int , int > using namespace std; typedef long long ll; typedef long double ld; typedef unsigned long long ull; const int N = 1e6 + 123; const int mod = 1e9 + 7; const int INF = 1e9 + 1; const ll INFL = 3e18 + 1; const double pi = acos(-1.0); int n, a[303]; int main () { ios_base::sync_with_stdio (0); cin.tie (0); cin >> n; for (int i = 1;i <= n;i ++) cin >> a[i]; sort (a + 1, a + n + 1); int l = 1, r = 0, mx = 0; while (l <= n && r <= n) { if (a[r] - a[l] > 1) l ++; else r ++; mx = max (r - l + 1, mx); } cout << mx - 1; return 0; }