#include "bits/stdc++.h"

using namespace std;
using ll = long long;
using ull = unsigned long long;

typedef pair<int, int>pi;
typedef pair<ll, ll> P;
typedef pair<ll, P> PP;
typedef pair<P, P> PPP;

const ll MOD = 1e9 + 7;
const ll INF = 9e18;
const double DINF = 5e14;
const double eps = 1e-10;
const int di[4] = { 1,0,-1,0 }, dj[4] = { 0,1,0,-1 };

#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define pb push_back
#define eb emplace_back
#define fr first
#define sc second

int n, a, ans;
vector<int>p;

int main() {
	cin >> n;
	for (int i = 0;i < n;i++) {
		cin >> a;
		p.eb(a);
	}
	sort(ALL(p));
	for (int i = 0;i <= 100;i++) {
		int cnt = 0;
		for (int j = 0;j < n;j++) {
			if (p[j] >= i)cnt++;
		}
		if (cnt >= i)ans = i;
	}
	cout << ans << endl;
	return 0;
}
