#include <bits/stdc++.h>
using namespace std;
int main() {
  int k;
  string n;
  cin >> k >> n;
  int sum = 0;
  for (int i = 0; i < n.size(); i++) {
    sum += (n[i] - '0');
  }
  if (sum >= k) {
    cout << "0";
    return 0;
  }
  int change = k - sum;
  int res = 0;
  int c = 0;
  sort(n.begin(), n.end());
  int i = 0;
  while (c < change) {
    c += ('9' - n[i]);
    res++;
    i++;
  }
  cout << res;
  return 0;
}
