#include #include #include #include #include #include using namespace std; int main() { /* Enter your code here. Read input from STDIN. Print output to STDOUT */ int n; cin>>n; int a[n],c=0,max=-1,k; map p; for(int i=0;i>k;p[k]++;} map::iterator pp=p.begin(),ppp=p.begin(); ppp++; while(pp!=p.end()) { if(abs(pp->first-ppp->first)<=1) {c=pp->second+ppp->second;} if(c>max) max=c; if(pp->second>max) max=pp->second; pp++;ppp++; } if(abs(pp->first-ppp->first)<=1) {c=pp->second+ppp->second;} if(c>max) max=c; if(pp->second>max) max=pp->second; cout<