fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main() {
  5. // your code goes here
  6. int n;cin>>n;
  7. vector<int>v(n);map<int,int>m;
  8. for(int i=0;i<n;i++){
  9. cin>>v[i];m[v[i]]++;
  10. }
  11. int mi=INT_MAX,ma=INT_MIN;
  12. for(auto x:v){
  13. mi=min(mi,m[x]);
  14. ma=max(ma,m[x]);
  15. }
  16. cout<<mi<<" "<<ma<<endl;
  17. return 0;
  18. }
Success #stdin #stdout 0s 5312KB
stdin
6
3 2 3 2 4 3
stdout
1 3