#include <iostream>
#include<vector>
using namespace std;

#define ARRAY_MAX 110

int main() {
	
	int pro = 0;
	cin >> pro;
	
	vector<int>array(ARRAY_MAX,0);
	vector<int>total(ARRAY_MAX,0);
	
	for(int i = 0;i < pro;i++){
		cin >> array[i];
	}
	
	int count = 0;
	int score = 0;
	int maxi = 0;

	for(int i = 1;i <= 100 ;i++){
		score = i;
		for(int j = 0;j < pro;j++){
			if(array[j] >= score){
				total[i]++;
			}
		
		}		
		if(score <= total[i]){
			maxi = i; 
		}
	}
		
	cout << maxi << endl;
	return 0;
}