// Slower C++ solution:
#include <algorithm>

#include <iostream>

#include <vector>

using namespace std;



const int MAX_N = 1e5 + 5;

int n, ans;

int Arr[MAX_N];

int cnt[MAX_N];



int main() {

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

	cin >> n;

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

		cin >> Arr[i];

		if (n < Arr[i]) {

			i--;

			n--;

			ans++;

		}

	}



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

		cnt[Arr[i]]++;



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

		if (cnt[i] < i)

			ans += cnt[i];

		else

			ans += (cnt[i] - i);



	cout << ans << "\n";

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 1.4802442367211435x):
//	Totally unrelated and not AT ALL stolen from hohohaha's template

#include <bits/stdc++.h>

using namespace std;

#define arctan atan

#define arccos acos

#define arcsin asin

#define mp make_pair

#define pb push_back

#define eb emplace_back

#define fi first

#define se second

#define lb lower_bound

#define ub upper_bound

#define vt vector

#define pr pair

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

#define Ahhhhhhhh		 "It's_ca_khia_Tham_:))"	// Rewind 2018 reference

#define Le_Minh_Tam		 "xinh"// though, a define is not needed.

#define Hoang_Duong		 "AC_10e69+7_bai_A_in_orz_minutes"

#define Andy_Duke_Anh	 "*Fantasie_Impromptu_100*"

#define Le_Phuc_Vinh	 "*T_dang_dung_check-pat*"

#define Kat_Bongo 		 "***Best_Python_Sniper***"

#define Chau_Vu	  		 "**SupaKHUNG_va_hoicham**"	// also very god of dp (yes, you read that right)

#define ZaP_zU	  		 "***Sieu_khung_va_orz***"	// also Asian tourist

#define Grey_rabbit		 "****Khung_ko_kem_ai****"

#define Pham_Hoang_Hiep	 "a.k.a_LuuNgocThaiSon-orz"

#define DTNhat_Long		 "***Bacc-tracc-ing_God***"

#define Nguyen_Nhat_Minh "**khungkhungkhungkhung**"	// I mean, there's not

#define Pham_Truong_Dat	 "orz_orz_ORZ!!!!!!!!!!!!!"	// much to say about

#define Duong_Minh_Khoi  "****don_thuan_la_ORZ****"	// these three people

#define Ta_Xuan_Duy  	 "*sieudepzainhungkokhung*"

#define Hachi_Minh		 "..." // yes, I haven't thought of one yet.  "F"s in the chat bois.

#define Lan_Leeeeee		 "Lan_le_bo_toai,_get_it??" // No? Ok fine that was smol pp joke on my part.

#define Chui_Minh_Hiu	 "Game_it_thoi"

#define endl			 "\n"

//	Disscliamer:  	- I do not know how to spell "Disclaimer" (thanks google for the correct spelling)

//					- Also, as stated by no laws that I can tell, the previous sentences are written for

//					the sake of "ca_khia"-ing. To the people mentioned in these sentences, the sentences

//					may not represent you as a person (though I do think that I'm pretty handsome myself)

//					and should not be taken as neither the truth, nor a personal attacc. Pls, no bulli.

//	Can't belive I spent 20+ lines and 6+ hours to do this. Oh well,

//	Until next time, remember:

//			You are closer, than you think.

typedef double db;         typedef long long li;        typedef long double ld;	         typedef string str;

typedef pr<int, int> ii;   typedef pr<li,li> ll;        typedef pr<ld,ld> dd;

typedef vt<int> vi;        typedef vt<li> vli;          typedef vt<bool> vb;

typedef vt<str> vs;        typedef vt<ii> vii;          typedef vt<ll> vll;

typedef map<int, int> mii; typedef map<int, bool> mib;  typedef map<int, str> mis;       typedef map<int, char> mic;

typedef set<int> s_i;      typedef set<char> s_c;       typedef set<str> s_s;

typedef complex<db> cpx;  typedef vt<cpx> vcpx;

const int mod = 1e9+7;     const li inf = 1e18;

#define pi 3.141592653589793

#define int li

//	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);

mii met;



signed main()

{

	int n; cin >> n;

	int a[n+2];

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

	{

		cin >> a[i]; ++met[a[i]];

	}

	int ans = 0;

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

	{

		if (met[a[i]] > a[i])

		{

			ans += met[a[i]] - a[i];

			met[a[i]] = 0;

		}

		else if (met[a[i]] < a[i])

		{

			ans += met[a[i]];

			met[a[i]] = 0;

		}

	}

	cout << ans;

}

// with the aura of Dora, AC!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!1!!!!!!!!!!!!!!!!!

// 	Why is there a one in my row of exclamation marks?