#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a[10];
  char s[100005];
  scanf("%d", &n);
  scanf("%s", s);
  int len = strlen(s);
  memset(a, 0, sizeof(a));
  for (int i = 0; i < len; 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;
}
