#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int k;
  cin >> k;
  string s;
  cin >> s;
  long long tot = 0;
  int av[11];
  memset(av, 0, sizeof(av));
  int ans = 0;
  for (char a : s) tot += a - '0', av[9 - (a - '0')]++;
  for (int i = 10; i; i--) {
    if (tot >= k) break;
    if (k - av[i] * i < tot) {
      while (k > tot) {
        k -= i;
        ans++;
      }
      break;
    } else {
      k -= av[i] * i;
      ans += av[i];
    }
  }
  cout << ans << "\n";
}
