#include <bits/stdc++.h>
using namespace std;
long long sum(string s) {
  long long ans = 0;
  for (int i = 0; i < s.size(); i++) {
    ans += (s[i] - '0');
  }
  return ans;
}
int main() {
  int k;
  cin >> k;
  string n;
  cin >> n;
  long long ans = sum(n);
  int fans = 0;
  sort(n.begin(), n.end());
  if (k > ans) {
    k -= ans;
    for (int i = 0; i < n.size() && k; i++) {
      if (n[i] == '9')
        continue;
      else
        k -= (min(9 - (n[i] - '0'), k)), fans++;
    }
  }
  cout << fans << endl;
}
