Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- int main()
- {
- int n;
- cin>>n;
- vector<int>v(n);
- for(int i=0;i<n;i++)
- {
- cin>>v[i];
- }
- map<int,int>mp;
- for(auto u:v)
- {
- mp[u]++;
- }
- int coun=0;
- for(auto u:mp)
- {
- if(u.first<u.second)
- {
- coun+=abs(u.first-u.second);
- }
- else if(u.first>u.second) coun+=u.second;
- }
- cout<<coun;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement