#include <bits/stdc++.h>
using namespace std;
const int maxn = 102;
int n, a[maxn], ans;
int main() {
  ios::sync_with_stdio(false);
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  sort(a + 1, a + n + 1);
  for (int i = 1; i <= n; i++) {
    if (n >= a[i])
      n -= a[i], ans++;
    else
      break;
  }
  cout << ans << endl;
  return 0;
}
