E.cpp 323 B

123456789101112131415161718192021
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. int main() {
  4. int n, x;
  5. cin >> n;
  6. map<int, int> m;
  7. for (int i = 0; i < n; i++) {
  8. cin >> x;
  9. m[x]++;
  10. }
  11. int p = 0;
  12. int t;
  13. for (auto q : m) {
  14. if (p < q.second) {
  15. p = q.second;
  16. t = q.first;
  17. }
  18. }
  19. cout << t << endl;
  20. cout << p << endl;
  21. }