#include<bits/stdc++.h>
using namespace std;
int main()
{
int n, a;
cin >> n;
int pre = -1;
int mark = 1, maxm = 0;
for (int i = 0; i < n; i++) {
cin >> a;
if ((pre + 1) == a) {
mark++;
pre = a;
} else {
if (mark > maxm) maxm = mark;
mark = 1;
}
}
if (mark > maxm) maxm = mark;
cout << maxm;
return 0;
}