#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  string chars;
  long long num, digits, sum;
  cin >> digits;
  cin >> chars;
  int len = chars.length();
  sum = 0;
  for (int i = 0; i < len; i++) sum += (chars[i] - '0');
  if (sum >= digits) {
    cout << 0 << endl;
    return 0;
  }
  sort(chars.begin(), chars.end());
  digits -= sum;
  sum = 0;
  for (int i = 0; i<len & digits> 0; i++, sum++) digits -= '9' - chars[i];
  cout << sum << endl;
  return 0;
}
