#include <bits/stdc++.h>
using namespace std;
char s[111111];
int rec[10];
int main() {
  int k;
  memset(rec, 0, sizeof(rec));
  scanf("%d", &k);
  scanf("%s", s);
  int sum = 0, cnt = 0, l = strlen(s) - 1;
  for (int i = l; i >= 0; i--) k -= (s[i] - '0'), rec[s[i] - '0']++;
  for (int i = 0; i<9, k> 0; i++) {
    int x = 9 - i;
    if (x * rec[i] < k)
      k -= x * rec[i], cnt += rec[i];
    else
      cnt += (k + x - 1) / x, k = 0;
  }
  cout << cnt << endl;
}
