#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a[10];
  char s[100005];
  while (~scanf("%d%s", &n, s)) {
    int len = strlen(s);
    for (int i = 0; i < strlen(s); i++) {
      a[s[i] - '0']++;
      n -= (s[i] - '0');
    }
    int ans = 0;
    for (int i = 0; i < 10; i++) {
      while (a[i] && n > 0) {
        n -= (9 - i);
        a[i]--;
        ans++;
      }
    }
    printf("%d\n", ans);
  }
  return 0;
}
