#include using namespace std; typedef long long ll; typedef unsigned long long ull; typedef vector vi; typedef vector vll; int inf_int=1e9; ll inf_ll=2e18; typedef pair pii; typedef pair pll; #define pb push_back const double pi=3.1415926535898; #define dout if(debug) cout #define fi first #define se second #define sp setprecision #define sz size() template void prin(vector >& a) { for(int i=0;i void prin(set >& a) { for(auto it=a.begin();it!=a.end();it++) { cout <fi <<" "<se<<"\n"; } } template void prin(vector& a) { for(int i=0;i void prin(set& a) { for(auto it=a.begin();it!=a.end();it++) { cout << *it<<" "; } } template void prin_new_line(vector& a) { for(int i=0;i void prin_new_line(vector >& a) { for(int i=0;i> n; map mp; vector a; for(int i=1;i<=n;i++) { int x; cin >> x; a.pb(x); mp[x]++; } int ans=0; for(int v:a) { ans=max(ans,mp[v]+mp[v-1]); } cout << ans; } #define FILE "rollback" int main() { #ifdef ILDAR freopen("input.txt","r",stdin); freopen("output.txt","w",stdout); #endif // ILDAR // freopen(FILE".in","r",stdin); // freopen(FILE".out","w",stdout); if(!debug) { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); } int t=1; // //scanf("%d",&t); // cin >> t; while(t--) solve(); return 0; }