#include #include using namespace std; using namespace atcoder; using ll = long long; using ld = long double; int N, cnt = 1, same = 0; ll A[101010]; int main() { cin >> N; for (int i = 0; i < N; i++) cin >> A[i]; sort(A, A + N); bool flag = false; for (int i = 0; i < N - 1; i++) { if (!flag && A[i] + 1 == A[i + 1]) { flag = true; cnt++; } if (A[i] == A[i + 1]) { same++; if (same > cnt) cnt++; } else same = 0; } cout << cnt << endl; return 0; }