// Slower C++ solution:


/// 28-01-2018

/// MD:NUR ALAM

/// Eastern University of Bangladesh



#include "bits/stdc++.h"



#define sz(x) ((int)(x).size())

#define all(x) (x).begin(), (x).end()

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

#define repp(i, a, b) for (int i = (a); i < (b); ++i)

#define fo(i, a, b) for (int i = (a); i <(b); ++i)

#define fors(i, s) for (int i = 0; s[i]; ++i)

#define rs(x) scanf("%s", (x))

#define mp make_pair

#define pb push_back

#define mso(X) memset((X), 0, sizeof((X)))

#define MS1(X) memset((X), -1, sizeof((X)))

#define len(X) strlen(x)

#define nur 100000

using namespace std;



typedef long long ll;

typedef uint64_t ull;

typedef long double lu;

typedef pair<int,int> pii;

typedef vector<int> vi;

typedef vector<pii> vpll;

typedef pair<int,int> Pll;

typedef map<string,int>msi;

typedef set<int>se;



template<class t> void _r(t &x) { cin >> x; }

void _r(int &x) { scanf("%d", &x); }

void _r(int64_t &x) { scanf("%lld", &x); }

void _r(double &x) { scanf("%lf", &x); }

void _r(char &x) { scanf(" %c", &x); }

void _r(char *x) { scanf("%s", x); }

void r() {}

template<class t, class... u> void r(t &head, u &... tail) { _r(head); r(tail...); }

template<class t> void _w(const t &x) { cout << x; }

void _w(const int &x) { printf("%d", x); }

void _w(const int64_t &x) { printf("%lld", x); }

void _w(const double &x) { printf("%.16f", x); }

void _w(const char &x) { putchar(x); }

void _w(const char *x) { printf("%s", x); }

template<class t,class u> void _w(const pair<t,u> &x) {_w(x.f); putchar(' '); _w(x.s);}

void w() {}

template<class t, class... u> void w(const t &head, const u &... tail) { _w(head); putchar(sizeof...(tail) ? ' ' : '\n'); w(tail...); }

template<class t, class... u> void debug(const t &head, const u &... tail) {

#ifdef HOME

#endif

}



///------------------------------------------------------------------------------------------------------------------------------------





int main()

{

    ll n,c=0,check[100005]={0};

    r(n);

    ll ar[n];



    rep(i,n){

        r(ar[i]);



        if(ar[i]>nur)

        {

            c++;

        }

        else if(ar[i]<=nur)

        {

            check[ar[i]]++;

        }

    }



    rep(i,nur){

        if(check[i]>i)

        {

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

        }

        else if(check[i]<i)

        {

            c = c+check[i];

        }

    }



    w(c);

}


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

#include <stdio.h>

#include <string.h>

#include <algorithm>

#include <math.h>

#include <stdlib.h>

#include <queue>

#include <stack>

#define ll long long

#define mem(a,b) memset(a,b,sizeof(a))

using namespace std;

const int maxn=1e5+5;

int a[maxn];

int main()

{

    int n;

    cin>>n;

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

        cin>>a[i];

    sort(a,a+n);

    int ans=1,ans_num=a[0],sum=0;

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

    {

        if(a[i]==ans_num)

            ans++;

        else

        {

            if(ans>=ans_num)

                sum+=ans-ans_num;

            else

                sum+=ans;

            ans_num=a[i];

            ans=1;

        }

    }

    if(ans>=ans_num)

        sum+=ans-ans_num;

    else

        sum+=ans;

    cout<<sum<<endl;

    return 0;

}

/*

4 8



*/