Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <list>
- #include <fstream>
- #include <algorithm>
- #include <cmath>
- #include <cstdlib>
- #include <iomanip>
- #include <map>
- #include <set>
- #define eps 0.1
- using namespace std;
- long long prod(long long x){
- long long t=0;
- long long res=1;
- while(true){
- res*=x%10;
- x/=10;
- if (x==0)
- break;
- }
- return res;
- }
- int max1(int x, int y){
- return (x>y?x:y);
- }
- int min1(int x, int y){
- return (x<y?x:y);
- }
- int main()
- {
- //ifstream fin("file.in");
- //ofstream fout("file.out");
- long long n, m;
- long long res=0;
- long long min, max;
- // cin.sync_with_stdio(false);
- //cout.sync_with_stdio(false);
- //int[] sett;
- map<int, int> mapp;
- cin >> n;
- int ll;
- for (int i=0; i<n; i++){
- cin >> ll;
- mapp[ll]++;
- }
- max;
- bool b;
- //bool[] b={};
- int prev;
- while (true){
- b = false;
- for (auto &mm:mapp){
- res++;
- mapp[mm.first]--;
- int mmm=mapp[mm.first];
- if (mmm<1)
- mapp.erase(mm.first);
- //cout << mm.first << ' ' ;
- b = true;
- }
- res--;
- if (!b)
- break;
- }
- res++;
- cout << res;
- //fin.close();
- //fout.close();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement