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;
- bool b1[2000]={};
- // cin.sync_with_stdio(false);
- //cout.sync_with_stdio(false);
- //int[] sett;
- //map<int, int> mapp;
- int mass[2000]={};
- cin >> n;
- int ll;
- for (int i=1; i<=n; i++){
- cin >> ll;
- mass[ll]++;
- b1[ll]=true;
- }
- bool b;
- int prev;
- while (true){
- b = false;
- for (int i=1; i<2000; i++){
- if (mass[i]>0){
- res++;
- mass[i]--;
- if (mass[i]==0)
- b1[i]=false;
- //cout << i;
- }
- }
- //cout << endl;
- for (int i=1; i<=2000; i++){
- if (b1[i])
- b=true;
- //cout << b1[i] << ' ';
- }
- //cout << b;
- res--;
- if (!b)
- break;
- }
- cout << res;
- //fin.close();
- //fout.close();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement