// No.112 ややこしい鶴亀算 // https://yukicoder.me/problems/no/112 // #include #include #include using namespace std; int main() { std::cin.tie(nullptr); std::ios::sync_with_stdio(false); int N; cin >> N; unordered_map counter; for (auto i = 0; i < N; ++i) { int tmp; cin >> tmp; counter[tmp]++; } vector> res; for (auto c: counter) { res.push_back(make_pair(c.first, c.second)); } int animal1_count =res[0].second; int count1 = res[0].first; if (res.size() == 1) { if (count1 + 2 == 2 * animal1_count) cout << animal1_count << " 0" << endl; else cout << "0 " << animal1_count << endl; } else { int animal2_count = res[1].second; int count2 = res[1].first; if (count1 > count2) cout << animal1_count << " " << animal2_count << endl; else cout << animal2_count << " " << animal1_count << endl; } }