#include <bits/stdc++.h>

using namespace std;

int n;
vector<int> p;

bool check(int mid) {
	return (end(p) - lower_bound(begin(p), end(p), mid)) >= mid;
}

void hawawa()
{
	cin >> n;
	p.resize(n);
	for (auto&& i : p) {
		cin >> i;
	}
	sort(begin(p), end(p));
	int ok = 1, ng = 101;
	while (abs(ok - ng) > 1) {
		int mid = (ok + ng) / 2;
		if (check(mid)) {
			ok = mid;
		}
		else {
			ng = mid;
		}
	}
	cout << ok << "\n";
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	hawawa();
	return 0;
}

