#include #include using namespace std; using P = pair; int main() { int N; cin >> N; map A; int a; for (int i = 0; i < N; i++) { cin >> a; A[a]++; } int t, k; P p1 = *A.begin(); if (p1.first + 2 == p1.second * 2) { t = p1.second; k = 0; } else { t = 0; k = p1.second; } if (A.size() > 1) { P p2 = *(++A.begin()); if (p2.first + 2 == p2.second * 2) { t = p2.second; k = p1.second; } else { t = p1.second; k = p2.second; } } cout << t << " " << k << endl; }