#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int i, j, k, n, day, ans, flag;
  cin >> n;
  long long int a[n];
  for (i = 0; i < n; i++) cin >> a[i];
  sort(a, a + n);
  day = 1;
  ans = 0;
  j = 0;
  while (1) {
    flag = 0;
    for (i = j; i < n; i++) {
      if (a[i] >= day) {
        j = i + 1;
        flag = 1;
        ans++;
        break;
      }
    }
    if (flag == 0) break;
    day++;
  }
  cout << ans << "\n";
  return 0;
}
