#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int k, c = 0, sum = 0;
  string n;
  cin >> k >> n;
  vector<long long int> v;
  vector<long long int>::iterator it;
  long long int i = 0;
  while (i < n.length()) {
    int r = int(n[i]) - 48;
    v.push_back(r);
    sum += r;
    i++;
  }
  if (sum >= k) {
    cout << "0";
    return 0;
  } else {
    sort(v.begin(), v.end());
    for (it = v.begin(); it != v.end(); it++) {
      sum -= *it;
      sum += 9;
      c++;
      if (sum >= k) break;
    }
  }
  cout << c;
}
