#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define rep(i, n) for(int i = 0; i < n; i++) #define per(i, n) for(int i = n - 1; i >= 0; i--) using ll = long long; #define vi vector #define vvi vector #define vl vector #define pii pair #define pll pair #define all(a) (a).begin(), (a).end() #define rall(a) (a).rbegin(), (a).rend() #define mod 1000000007 using namespace std; int main(){ int n; cin >> n; vi a(n); rep(i, n) cin >> a[i]; sort(all(a)); int ans = 0, cnt = 0; for(int i = 1; i < n; i++){ if(a[i - 1] + 1 == a[i]) cnt++; else{ ans = max(ans, cnt); cnt = 0; } } ans = max(ans, cnt); cout << ans + 1 << "\n"; }