You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

18 lines
314 B

#include<iostream>
using namespace std;
int main() {
int n, ans = 0, c, b, max = 1;
cin >> n >> b;
for (int i = 0; i < n - 1; i++) {
cin >> c;
if (c == b + 1) max++;
else max = 1;
if (ans < max) ans = max;
b = c;
}
cout << ans << endl;
return 0;
}