#include <bits/stdc++.h>
using namespace std;
int main() {
  int k;
  string s;
  scanf("%d", &k);
  cin >> s;
  int ans = 0, sum = 0;
  for (int i = 0; i < s.size(); i++) sum += s[i] - '0';
  sort(s.begin(), s.end());
  if (sum >= k)
    puts("0");
  else {
    int l = 0;
    while (l < s.size() && sum < k) {
      sum += 9 - (s[l] - '0');
      if ((s[l] - '0') != 9) ans++;
      l++;
    }
    printf("%d\n", ans);
  }
  return 0;
}
