#include #include using namespace std; int main() { int n; cin>>n; int A[n]; for(int i=0;i>A[i]; map mp; for(int i=0;i::iterator it; it = mp.begin(); int a = (it)->first; int b = (it)->second; int count=0,m=b; it++; for(;it!=mp.end();it++) { int c = (it)->first; int d = (it)->second; m = max(m,d); if((c-a)<=1) { count = max(count,b+d); a = c; b = d; } a = c; b = d; } if(count!=0 && count>=m) cout<