#include <bits/stdc++.h>
using namespace std;
const int maxn = 100000 + 10;
char a[maxn];
int main() {
  int k;
  while (scanf("%d %s", &k, a) != EOF) {
    int len = strlen(a);
    int sum = 9 * len;
    int ans = 0;
    sort(a, a + len);
    for (int i = len - 1; i >= 0; i--) {
      if (a[i] == '9')
        continue;
      else {
        int num = '9' - a[i];
        sum -= num;
        if (sum < k)
          ans++;
        else {
          continue;
        }
      }
    }
    cout << ans << endl;
  }
  return 0;
}
