#include <bits/stdc++.h>
using namespace std;
int tab[1003];
int main() {
int n,x,l,wyn;
cin >> n;
for(int i = 0;i < n;++i){
cin >> x;
tab[x]++;
}
l = 0;
wyn = 0;
for(int i = 0;i < 1002;++i){
if(tab[i] > 0){
l++;
}
else{
wyn = max(wyn,l);
l = 0;
}
}
cout << wyn;
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CgppbnQgdGFiWzEwMDNdOwoKaW50IG1haW4oKSB7CglpbnQgbix4LGwsd3luOwoJY2luID4+IG47Cglmb3IoaW50IGkgPSAwO2kgPCBuOysraSl7CgkJY2luID4+IHg7CgkJdGFiW3hdKys7Cgl9CglsID0gMDsKCXd5biA9IDA7Cglmb3IoaW50IGkgPSAwO2kgPCAxMDAyOysraSl7CgkJaWYodGFiW2ldID4gMCl7CgkJCWwrKzsKCQl9CgkJZWxzZXsKCQkJd3luID0gbWF4KHd5bixsKTsKCQkJbCA9IDA7CgkJfQoJfQoJY291dCA8PCB3eW47CglyZXR1cm4gMDsKCQp9