#include <bits/stdc++.h>
using namespace std;
bool isopen(char ch) {
  if (ch == '<' || ch == '{' || ch == '(' || ch == '[') return true;
  return false;
}
int main() {
  int k, sum = 0, ans = 0;
  string s;
  cin >> k >> s;
  int c[10] = {0};
  for (long long int i = 0; i < s.size(); i++) {
    sum = sum + s[i] - '0';
    int d = s[i] - '0';
    c[d]++;
  }
  for (int i = 0; i < 9; i++)
    for (int j = 0; j < c[i]; j++) {
      if (k > sum) {
        sum = sum + 9 - i;
        ans++;
      }
    }
  cout << ans;
}
