stablegradients/pie-gem5-pairs huggingface dataset:
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;



int main()

{

    long int n,ar[100005],check[100005]={0},i,c=0;

    cin>>n;

    for(i=0;i<n;i++)

    {

        cin>>ar[i];

        if(ar[i]>100000)

        {

            c++;

        }

        else if(ar[i]<=100000)

        {

            check[ar[i]]++;

        }

    }



    for(i=0;i<=100000;i++)

    {

        if(check[i]>i)

        {

            c = c+(check[i]-i);

        }

        else if(check[i]<i)

        {

            c = c+check[i];

        }

    }

    cout<<c<<endl;

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 1.9951410758400983x):
#include<bits/stdc++.h>

using namespace std;

int n,x,ans;

map<int,int>mp; 

int main()

{

	cin>>n;

	for(int i=0;i<n;i++)

	{

		cin>>x;

		mp[x]++;

	}

	for(map<int,int>::iterator it=mp.begin();it!=mp.end();it++)

		if(it->second>=it->first)

			ans+=it->second-it->first;

		else

			ans+=it->second;

	cout<<ans<<endl;

	return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;



const int N = 1e5 + 100;



int n, num, ans, cnt[N];



int main() {

	ios::sync_with_stdio(false), cin.tie(0);

	cin >> n;

	while(n--) {

		cin >> num;

		if(num >= N)

			ans++;

		else

			cnt[num]++;

	}

	for (int i = 1; i < N; i++)

		if(cnt[i] < i)

			ans += cnt[i];

		else

			ans += cnt[i] - i;

	cout << ans;

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 1.4738519104545789x):
#include<bits/stdc++.h>

using namespace std;

int n,x,ans;

map<int,int>mp; 

int main()

{

	cin>>n;

	for(int i=0;i<n;i++)

	{

		cin>>x;

		mp[x]++;

	}

	for(map<int,int>::iterator it=mp.begin();it!=mp.end();it++)

		if(it->second>=it->first)

			ans+=it->second-it->first;

		else

			ans+=it->second;

	cout<<ans<<endl;

	return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;



int main()

{

    long int n,ar[100005],check[100005]={0},i,c=0;

    cin>>n;

    for(i=0;i<n;i++)

    {

        cin>>ar[i];

        if(ar[i]>100000)

        {

            c++;

        }

        else if(ar[i]<=100000)

        {

            check[ar[i]]++;

        }

    }



    for(i=0;i<=100000;i++)

    {

        if(check[i]>i)

        {

            c = c+(check[i]-i);

        }

        else if(check[i]<i)

        {

            c = c+check[i];

        }

    }

    cout<<c<<endl;

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 2.0033814689564853x):
#include<bits/stdc++.h>

using namespace std;



const int N=1e5 +3;

int a[N];

map<int, int> mp;



int main(){



    int n;

    scanf("%d", &n);

    for(int i=0; i<n; ++i){

        scanf("%d", a+i);

        ++mp[a[i]];

    }



    int ans=0;

    for(auto i:mp){

        if(i.second<i.first)

            ans+=i.second;

        else

            ans+=i.second-i.first;

    }



    printf("%d", ans);



    return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;



const int N = 1e5 + 100;



int n, num, ans, cnt[N];



int main() {

	ios::sync_with_stdio(false), cin.tie(0);

	cin >> n;

	while(n--) {

		cin >> num;

		if(num >= N)

			ans++;

		else

			cnt[num]++;

	}

	for (int i = 1; i < N; i++)

		if(cnt[i] < i)

			ans += cnt[i];

		else

			ans += cnt[i] - i;

	cout << ans;

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 1.4799392590057932x):
#include<bits/stdc++.h>

using namespace std;



const int N=1e5 +3;

int a[N];

map<int, int> mp;



int main(){



    int n;

    scanf("%d", &n);

    for(int i=0; i<n; ++i){

        scanf("%d", a+i);

        ++mp[a[i]];

    }



    int ans=0;

    for(auto i:mp){

        if(i.second<i.first)

            ans+=i.second;

        else

            ans+=i.second-i.first;

    }



    printf("%d", ans);



    return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;



int main()

{

    long int n,ar[100005],check[100005]={0},i,c=0;

    cin>>n;

    for(i=0;i<n;i++)

    {

        cin>>ar[i];

        if(ar[i]>100000)

        {

            c++;

        }

        else if(ar[i]<=100000)

        {

            check[ar[i]]++;

        }

    }



    for(i=0;i<=100000;i++)

    {

        if(check[i]>i)

        {

            c = c+(check[i]-i);

        }

        else if(check[i]<i)

        {

            c = c+check[i];

        }

    }

    cout<<c<<endl;

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 1.9545637460130996x):




/*@author hussein zayed ;

    ___  ___

   |\  \|\  \

   \ \  \_\  \

    \ \   ___ \USSEIN

     \ \  \\ \ \

      \ \__\\ \_\

       \|__| \|__|

****************************************

*/



#include <bits/stdc++.h>

using namespace std;

#define fr for(int i=0;i<n;++i)

#define fr1 for(int i=1;i<=n;++i)

#define cinA for(int i=0;i<n;++i){cin>>arr[i];}

#define cinA1 for(int i=1;i<=n;++i){cin>>arr[i];}

#define coutA for(int i=0;i<n;++i){cout<<arr[i]<<" ";}

#define ll long long

#define lnarray sizeof(arr)/sizeof(*arr)

#define vi vector<int>

#define vs vector<string>

void Fast()

{

    ios_base :: sync_with_stdio( 0 ) ;

    cin.tie( 0 ) ;

    cout.tie( 0 ) ;

}

inline int RD()

{

    int i ;

    cin>>i;

    return i;

}



inline float RF()

{

    float i ;

    cin>>i;

    return i;

}



inline double RDO()

{

    double i ;

    cin>>i;

    return i;

}



inline string RS()

{

    string i ;

    cin>>i;

    return i;

}



inline ll RLL()

{

    ll i ;

    cin>>i;

    return i;

}



int cm[200000];



ll sumSet(ll n)

{

    return (1ll*n*(n+1))/2;

}

string s;





bool isPrime(int n)

{

    if(n==1)

        return false;

    for(int i=2; i*i<=n; ++i)

    {

        if(n%i==0)

            return false;

    }

    return true;

}

int sumDigit(int n){

int sum =0;

  while (n != 0)

    {

        sum+= + n % 10;

        n = n / 10;

    }

    return sum;

}



ll power2(int n){

  ll ans=(1<<n);

  return ans;

}



ll sumpow2(ll n){

 ll sum=(n*(n+1)*(2*n-1))/6;

 return sum;

}

map<int ,int> mp;

vi vr;

int main(){

    Fast();

//freopen("output.txt" , "w" , stdout);

//freopen("wall.in" , "r" , stdin);

int n=RD(),a,cont=0,arr[n+3];

fr{

cin>>arr[i];

 mp[arr[i]]++;

}



set<int>st;

fr{

 st.insert(arr[i]);

}

 for (set<int>::iterator it=st.begin(); it!=st.end(); ++it)

   vr.push_back( *it);





for(int i=0;i<vr.size();++i){



if(mp[vr[i]]>0){



 if(mp[vr[i]]>=vr[i])

 cont+=mp[vr[i]]-vr[i];



 else

 cont+=mp[vr[i]];







}

}



 cout<<cont;

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;



const int N = 1e5 + 100;



int n, num, ans, cnt[N];



int main() {

	ios::sync_with_stdio(false), cin.tie(0);

	cin >> n;

	while(n--) {

		cin >> num;

		if(num >= N)

			ans++;

		else

			cnt[num]++;

	}

	for (int i = 1; i < N; i++)

		if(cnt[i] < i)

			ans += cnt[i];

		else

			ans += cnt[i] - i;

	cout << ans;

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 1.4438765990288014x):




/*@author hussein zayed ;

    ___  ___

   |\  \|\  \

   \ \  \_\  \

    \ \   ___ \USSEIN

     \ \  \\ \ \

      \ \__\\ \_\

       \|__| \|__|

****************************************

*/



#include <bits/stdc++.h>

using namespace std;

#define fr for(int i=0;i<n;++i)

#define fr1 for(int i=1;i<=n;++i)

#define cinA for(int i=0;i<n;++i){cin>>arr[i];}

#define cinA1 for(int i=1;i<=n;++i){cin>>arr[i];}

#define coutA for(int i=0;i<n;++i){cout<<arr[i]<<" ";}

#define ll long long

#define lnarray sizeof(arr)/sizeof(*arr)

#define vi vector<int>

#define vs vector<string>

void Fast()

{

    ios_base :: sync_with_stdio( 0 ) ;

    cin.tie( 0 ) ;

    cout.tie( 0 ) ;

}

inline int RD()

{

    int i ;

    cin>>i;

    return i;

}



inline float RF()

{

    float i ;

    cin>>i;

    return i;

}



inline double RDO()

{

    double i ;

    cin>>i;

    return i;

}



inline string RS()

{

    string i ;

    cin>>i;

    return i;

}



inline ll RLL()

{

    ll i ;

    cin>>i;

    return i;

}



int cm[200000];



ll sumSet(ll n)

{

    return (1ll*n*(n+1))/2;

}

string s;





bool isPrime(int n)

{

    if(n==1)

        return false;

    for(int i=2; i*i<=n; ++i)

    {

        if(n%i==0)

            return false;

    }

    return true;

}

int sumDigit(int n){

int sum =0;

  while (n != 0)

    {

        sum+= + n % 10;

        n = n / 10;

    }

    return sum;

}



ll power2(int n){

  ll ans=(1<<n);

  return ans;

}



ll sumpow2(ll n){

 ll sum=(n*(n+1)*(2*n-1))/6;

 return sum;

}

map<int ,int> mp;

vi vr;

int main(){

    Fast();

//freopen("output.txt" , "w" , stdout);

//freopen("wall.in" , "r" , stdin);

int n=RD(),a,cont=0,arr[n+3];

fr{

cin>>arr[i];

 mp[arr[i]]++;

}



set<int>st;

fr{

 st.insert(arr[i]);

}

 for (set<int>::iterator it=st.begin(); it!=st.end(); ++it)

   vr.push_back( *it);





for(int i=0;i<vr.size();++i){



if(mp[vr[i]]>0){



 if(mp[vr[i]]>=vr[i])

 cont+=mp[vr[i]]-vr[i];



 else

 cont+=mp[vr[i]];







}

}



 cout<<cont;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;



int main()

{

    long int n,ar[100005],check[100005]={0},i,c=0;

    cin>>n;

    for(i=0;i<n;i++)

    {

        cin>>ar[i];

        if(ar[i]>100000)

        {

            c++;

        }

        else if(ar[i]<=100000)

        {

            check[ar[i]]++;

        }

    }



    for(i=0;i<=100000;i++)

    {

        if(check[i]>i)

        {

            c = c+(check[i]-i);

        }

        else if(check[i]<i)

        {

            c = c+check[i];

        }

    }

    cout<<c<<endl;

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 1.9525335602477027x):
#include <bits/stdc++.h>

#define ll long long

#define endl "\n"

using namespace std ;

const int N = 1e7 + 4;

void FastInputOutput()

{

    ios_base :: sync_with_stdio( 0 ) ;

    cin.tie( 0 ) ;

    cout.tie( 0 ) ;

}

inline ll LLD()

{

    ll ret;

    scanf("%lld", &ret);

    return ret;

}

inline int D()

{

    int ret;

    scanf("%d", &ret);

    return ret;

}

void bin( int x )

{

    if(!x)

        return;

    bin( x / 2 );

    cout << x % 2 ;

}

bool checkPrimeNumber(int n)

{

    bool flag = true;

    for(int j = 2 ; j <= n ; ++j)

    {

        if (n % j == 0)

        {

            flag = false;

            break;

        }

    }

    return flag;

}

bool cmp(string last, string first)

{

    if(last.size() < first.size())

        return 1;

    return 0;

}

int calculateDigit(int n)

{

    double temp = (double)(n);

    double a = 0.39908-(0.434294 * n);

    double b = log10( n ) ;

    double c = ( n + 0.5 ) * b ;

    double ans = c - abs( a ) ;

    return ceil(ans) ;

}

int findDigits(int n)

{

    double E = 2.71828182845904523536;

    double PI = 3.141592654;



    if (n < 0)

        return 0;

    if (n <= 1)

        return 1;



    double x = ((n * log10(n / E) +

                 log10(2.0 * PI * n) /

                 2.0));



    return floor(x) + 1;

}

ll fact(ll n)

{

    ll ans = 1 ;

    for(ll i = 1 ; i <= n ; ++i)

        ans *= i ;

    return ans ;

}



int arr[ N ];

int main()

{

    FastInputOutput() ;

    int n ;

    map < int, int > mp ;

    cin >> n ;

    for(int i = 0 ; i < n ; ++i)

    {

        cin >> arr[ i ] ;

        ++mp[arr[ i ]] ;

    }

    int cnt = 0 , cnt1 = 0 ;

    map < int, int > ::iterator it ;

    for(it = mp.begin() ; it != mp.end() ; ++it)

        if(it->first > it->second)

            cnt += it->second ;

            else

                cnt += (it->second - it->first);

    cout << cnt << endl ;



}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;



const int N = 1e5 + 100;



int n, num, ans, cnt[N];



int main() {

	ios::sync_with_stdio(false), cin.tie(0);

	cin >> n;

	while(n--) {

		cin >> num;

		if(num >= N)

			ans++;

		else

			cnt[num]++;

	}

	for (int i = 1; i < N; i++)

		if(cnt[i] < i)

			ans += cnt[i];

		else

			ans += cnt[i] - i;

	cout << ans;

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 1.4423768588825323x):
#include <bits/stdc++.h>

#define ll long long

#define endl "\n"

using namespace std ;

const int N = 1e7 + 4;

void FastInputOutput()

{

    ios_base :: sync_with_stdio( 0 ) ;

    cin.tie( 0 ) ;

    cout.tie( 0 ) ;

}

inline ll LLD()

{

    ll ret;

    scanf("%lld", &ret);

    return ret;

}

inline int D()

{

    int ret;

    scanf("%d", &ret);

    return ret;

}

void bin( int x )

{

    if(!x)

        return;

    bin( x / 2 );

    cout << x % 2 ;

}

bool checkPrimeNumber(int n)

{

    bool flag = true;

    for(int j = 2 ; j <= n ; ++j)

    {

        if (n % j == 0)

        {

            flag = false;

            break;

        }

    }

    return flag;

}

bool cmp(string last, string first)

{

    if(last.size() < first.size())

        return 1;

    return 0;

}

int calculateDigit(int n)

{

    double temp = (double)(n);

    double a = 0.39908-(0.434294 * n);

    double b = log10( n ) ;

    double c = ( n + 0.5 ) * b ;

    double ans = c - abs( a ) ;

    return ceil(ans) ;

}

int findDigits(int n)

{

    double E = 2.71828182845904523536;

    double PI = 3.141592654;



    if (n < 0)

        return 0;

    if (n <= 1)

        return 1;



    double x = ((n * log10(n / E) +

                 log10(2.0 * PI * n) /

                 2.0));



    return floor(x) + 1;

}

ll fact(ll n)

{

    ll ans = 1 ;

    for(ll i = 1 ; i <= n ; ++i)

        ans *= i ;

    return ans ;

}



int arr[ N ];

int main()

{

    FastInputOutput() ;

    int n ;

    map < int, int > mp ;

    cin >> n ;

    for(int i = 0 ; i < n ; ++i)

    {

        cin >> arr[ i ] ;

        ++mp[arr[ i ]] ;

    }

    int cnt = 0 , cnt1 = 0 ;

    map < int, int > ::iterator it ;

    for(it = mp.begin() ; it != mp.end() ; ++it)

        if(it->first > it->second)

            cnt += it->second ;

            else

                cnt += (it->second - it->first);

    cout << cnt << endl ;



}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;



int main()

{

    long int n,ar[100005],check[100005]={0},i,c=0;

    cin>>n;

    for(i=0;i<n;i++)

    {

        cin>>ar[i];

        if(ar[i]>100000)

        {

            c++;

        }

        else if(ar[i]<=100000)

        {

            check[ar[i]]++;

        }

    }



    for(i=0;i<=100000;i++)

    {

        if(check[i]>i)

        {

            c = c+(check[i]-i);

        }

        else if(check[i]<i)

        {

            c = c+check[i];

        }

    }

    cout<<c<<endl;

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 1.997657939036611x):
#include <bits/stdc++.h>



#define ft first

#define sd second



using namespace std;

















int n;

map<int, int> mp;

int ans;



int main() {

	cin >> n;

	{

		int a;

		for (int i = 0; i < n; i++) {

			cin >> a;

			mp[a]++;

		}

	}

	for (auto i : mp) {

		if (i.sd < i.ft)

			ans += i.sd;

		else

			ans += i.sd - i.ft;

	}

	cout << ans;

	return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;



const int N = 1e5 + 100;



int n, num, ans, cnt[N];



int main() {

	ios::sync_with_stdio(false), cin.tie(0);

	cin >> n;

	while(n--) {

		cin >> num;

		if(num >= N)

			ans++;

		else

			cnt[num]++;

	}

	for (int i = 1; i < N; i++)

		if(cnt[i] < i)

			ans += cnt[i];

		else

			ans += cnt[i] - i;

	cout << ans;

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 1.4757111692686309x):
#include <bits/stdc++.h>



#define ft first

#define sd second



using namespace std;

















int n;

map<int, int> mp;

int ans;



int main() {

	cin >> n;

	{

		int a;

		for (int i = 0; i < n; i++) {

			cin >> a;

			mp[a]++;

		}

	}

	for (auto i : mp) {

		if (i.sd < i.ft)

			ans += i.sd;

		else

			ans += i.sd - i.ft;

	}

	cout << ans;

	return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;



int main()

{

    long int n,ar[100005],check[100005]={0},i,c=0;

    cin>>n;

    for(i=0;i<n;i++)

    {

        cin>>ar[i];

        if(ar[i]>100000)

        {

            c++;

        }

        else if(ar[i]<=100000)

        {

            check[ar[i]]++;

        }

    }



    for(i=0;i<=100000;i++)

    {

        if(check[i]>i)

        {

            c = c+(check[i]-i);

        }

        else if(check[i]<i)

        {

            c = c+check[i];

        }

    }

    cout<<c<<endl;

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 1.9533486480745634x):
#include <bits/stdc++.h>



using namespace std ;



const int MAX = 1e5 + 10 ;



int arr[MAX] ;

int n ;



int main()

{

	ios_base::sync_with_stdio(0) ;

	cin.tie(0) ;

	cin>>n ;

	map<int , int>mp ;

	for(int i = 0 ; i < n ; ++i)

	{

		int x ;

		cin>>x ;

		mp[x]++ ;

	}

	int ans = 0 ;

	for(auto &i : mp)

	{

		if(i.second < i.first)

			ans += i.second ;

		else

			ans += i.second - i.first ;

	}

	return cout<<ans<<"\n" , 0 ;

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;



const int N = 1e5 + 100;



int n, num, ans, cnt[N];



int main() {

	ios::sync_with_stdio(false), cin.tie(0);

	cin >> n;

	while(n--) {

		cin >> num;

		if(num >= N)

			ans++;

		else

			cnt[num]++;

	}

	for (int i = 1; i < N; i++)

		if(cnt[i] < i)

			ans += cnt[i];

		else

			ans += cnt[i] - i;

	cout << ans;

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 1.4429789810910087x):
#include <bits/stdc++.h>



using namespace std ;



const int MAX = 1e5 + 10 ;



int arr[MAX] ;

int n ;



int main()

{

	ios_base::sync_with_stdio(0) ;

	cin.tie(0) ;

	cin>>n ;

	map<int , int>mp ;

	for(int i = 0 ; i < n ; ++i)

	{

		int x ;

		cin>>x ;

		mp[x]++ ;

	}

	int ans = 0 ;

	for(auto &i : mp)

	{

		if(i.second < i.first)

			ans += i.second ;

		else

			ans += i.second - i.first ;

	}

	return cout<<ans<<"\n" , 0 ;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;



int main()

{

    long int n,ar[100005],check[100005]={0},i,c=0;

    cin>>n;

    for(i=0;i<n;i++)

    {

        cin>>ar[i];

        if(ar[i]>100000)

        {

            c++;

        }

        else if(ar[i]<=100000)

        {

            check[ar[i]]++;

        }

    }



    for(i=0;i<=100000;i++)

    {

        if(check[i]>i)

        {

            c = c+(check[i]-i);

        }

        else if(check[i]<i)

        {

            c = c+check[i];

        }

    }

    cout<<c<<endl;

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 1.9816057342071247x):
#include <bits/stdc++.h>



using namespace std;



typedef long long ll;



double getTime() {

  return clock() / (double) CLOCKS_PER_SEC;

}



void read() {};



template<typename T, typename... Args>

void read(T& a, Args&... args) {

  cin >> a;

  read(args...);

}



void print() {};



template <typename T, typename... Args>

void print(T a, Args... args) {

  cout << a << " \n"[sizeof...(args) == 0];

  print(args...);

}



ll get(ll x, ll y) {

  return (x / y);

}



int main() {

  int n; read(n);

  map <int, int> cnt;

  for(int i = 0; i < n; i++) {

    int x; cin >> x;

    cnt[x]++;

  }

  int ans = 0;

  for(auto x : cnt) {

    if(x.second < x.first) {

      ans += x.second;

    }

    else {

      ans += x.second - x.first;

    }

  }

  print(ans);

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;



const int N = 1e5 + 100;



int n, num, ans, cnt[N];



int main() {

	ios::sync_with_stdio(false), cin.tie(0);

	cin >> n;

	while(n--) {

		cin >> num;

		if(num >= N)

			ans++;

		else

			cnt[num]++;

	}

	for (int i = 1; i < N; i++)

		if(cnt[i] < i)

			ans += cnt[i];

		else

			ans += cnt[i] - i;

	cout << ans;

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 1.4638530740986015x):
#include <bits/stdc++.h>



using namespace std;



typedef long long ll;



double getTime() {

  return clock() / (double) CLOCKS_PER_SEC;

}



void read() {};



template<typename T, typename... Args>

void read(T& a, Args&... args) {

  cin >> a;

  read(args...);

}



void print() {};



template <typename T, typename... Args>

void print(T a, Args... args) {

  cout << a << " \n"[sizeof...(args) == 0];

  print(args...);

}



ll get(ll x, ll y) {

  return (x / y);

}



int main() {

  int n; read(n);

  map <int, int> cnt;

  for(int i = 0; i < n; i++) {

    int x; cin >> x;

    cnt[x]++;

  }

  int ans = 0;

  for(auto x : cnt) {

    if(x.second < x.first) {

      ans += x.second;

    }

    else {

      ans += x.second - x.first;

    }

  }

  print(ans);

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;



int main()

{

    long int n,ar[100005],check[100005]={0},i,c=0;

    cin>>n;

    for(i=0;i<n;i++)

    {

        cin>>ar[i];

        if(ar[i]>100000)

        {

            c++;

        }

        else if(ar[i]<=100000)

        {

            check[ar[i]]++;

        }

    }



    for(i=0;i<=100000;i++)

    {

        if(check[i]>i)

        {

            c = c+(check[i]-i);

        }

        else if(check[i]<i)

        {

            c = c+check[i];

        }

    }

    cout<<c<<endl;

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 1.984474325526024x):
#include<iostream>

#include<cstdio>

#include<string>

#include<vector>

#include<queue>

#include<cmath>

#include<algorithm>

#include<iomanip>

#include<functional>

#include<set>

#include<map>

#include<climits>

#include<utility>

#define ul unsigned long long int

#define ll long long int

#define MAX 1000000+1

using namespace std;

#define F first

#define S second

#define pi 2*acos(0.0)

#define PB push_back

#define CL clear()















int main()

{

       map<ll, ll> v;

       ll n;

       cin >> n;

       for(ll i = 0; i <n; i++)

       {

           ll r;

           cin >> r;

           if(!v.count(r))

           {

               v[r] = 0;

           }

           v[r]++;

       }

       map<ll, ll> :: iterator it;

       ll r = 0;

       for(it = v.begin(); it!= v.end(); it++)

       {

           if(it->F< it->S) r+=(it->S- it->F);

           else if(it->S < it ->F) r+= it->S;



       }

       cout << r;



    return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;



const int N = 1e5 + 100;



int n, num, ans, cnt[N];



int main() {

	ios::sync_with_stdio(false), cin.tie(0);

	cin >> n;

	while(n--) {

		cin >> num;

		if(num >= N)

			ans++;

		else

			cnt[num]++;

	}

	for (int i = 1; i < N; i++)

		if(cnt[i] < i)

			ans += cnt[i];

		else

			ans += cnt[i] - i;

	cout << ans;

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 1.4659721617395058x):
#include<iostream>

#include<cstdio>

#include<string>

#include<vector>

#include<queue>

#include<cmath>

#include<algorithm>

#include<iomanip>

#include<functional>

#include<set>

#include<map>

#include<climits>

#include<utility>

#define ul unsigned long long int

#define ll long long int

#define MAX 1000000+1

using namespace std;

#define F first

#define S second

#define pi 2*acos(0.0)

#define PB push_back

#define CL clear()















int main()

{

       map<ll, ll> v;

       ll n;

       cin >> n;

       for(ll i = 0; i <n; i++)

       {

           ll r;

           cin >> r;

           if(!v.count(r))

           {

               v[r] = 0;

           }

           v[r]++;

       }

       map<ll, ll> :: iterator it;

       ll r = 0;

       for(it = v.begin(); it!= v.end(); it++)

       {

           if(it->F< it->S) r+=(it->S- it->F);

           else if(it->S < it ->F) r+= it->S;



       }

       cout << r;



    return 0;

}