#include<cstdio>
#include<iostream>
#include<algorithm>
#include<string>
#include<queue>
#include<vector>
#include<functional>
#include<cmath>
#include<map>
#include<stack>
#include<set>
#include<numeric>
#include<limits>
#include<iterator>

#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()

using namespace std;
typedef long long ll;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<ll, char> plc;

int p[110];

int main()
{
	int n; cin >> n;
	for (int i = 0; i < n; i++) cin >> p[i];

	int mx = 0;
	for (int i = 1; i <= 100; i++) {
		int num = 0;
		for (int j = 0; j < n; j++) {
			if (p[j] >= i) num++;
		}
		if (num >= i)mx = i;
	}
	cout << mx << endl;
	return 0;
}