#include <bits/stdc++.h>
using namespace std;
long long p, sum = 0;
string c;
int s = 0, i;
int main() {
  while (cin >> p >> c) {
    sort(c.begin(), c.end());
    for (int i = 0; i < c.size(); i++) {
      sum += (c[i] - '0');
    }
    if (sum >= p) {
      cout << 0 << endl;
    } else {
      p -= sum;
      for (i = 0; i <= c.size() - 1; i++) {
        s += ('9' - c[i]);
        if (s >= p) {
          break;
        }
      }
      cout << i + 1 << endl;
    }
  }
  return 0;
}
