#include <bits/stdc++.h>
using namespace std;
int main() {
  int k, sum = 0, count = 0, num[10] = {0};
  string n;
  cin >> k >> n;
  for (int i = 0; i < n.size(); i++)
    sum += int(n[i]) - 48, num[int(n[i]) - 48]++;
  if (sum >= k)
    cout << 0;
  else
    for (int i = 0; i < 10; i++)
      for (int j = 0; j < num[i]; j++) {
        sum += 9 - i;
        count++;
        if (sum >= k) {
          cout << count;
          return 0;
        }
      }
  return 0;
}
