#include <bits/stdc++.h>

using namespace std;

int N;
int Score[100];

void solve() {
	int maxScore;

	maxScore = 0;
	for (int i = 0; i < N; ++i) {
		//cout << "curScore:" << Score[i] << " <=:" << N-i << endl;
		maxScore = max(maxScore,min(Score[i], N - i));
	}
	cout << maxScore << endl;
}

int main() {

	memset(Score, 0, sizeof(Score));
	cin >> N;
	for (int i = 0; i < N; ++i) {
		cin >> Score[i];
	}
	sort(Score, Score + N);
	solve();

	return 0;
}

