#include #include #include #include using namespace std; int main(void) { int n; cin >> n; vector a(n); for (int i = 0; i < n; i++) { cin >> a[i]; } sort(a.begin(), a.end()); int p = 1, d = 1; int max_p = p, max_d = d; for (int i = 1; i < n; i++) { if (a[i] == a[i - 1] + 1) { d++; if (max_d < d) { max_d = d; max_p = p; } } else if (a[i] != a[i - 1]) { p = a[i]; d = 1; } } for (int i = max_p; i < max_p + max_d; i++) { cout << i << endl; } return 0; }