#include <bits/stdc++.h>
using namespace std;
int f[105];
char a[100005];
int main() {
  memset(f, 0, sizeof(f));
  int k;
  scanf("%d", &k);
  scanf("%s", a);
  int a1 = strlen(a);
  int sum = 0;
  int z;
  for (int i = 0; i <= a1 - 1; i++) {
    z = a[i] - '0';
    f[z]++;
    sum += z;
  }
  k -= sum;
  int num = 0;
  for (int i = 0; i <= 9; i++) {
    if (k <= 0) break;
    z = min(k / (9 - i), f[i]);
    num += z;
    k = k - z * (9 - i);
    f[i] -= z;
    if (k > 0 && f[i] > 0) {
      num++;
      k = 0;
      f[i]--;
    }
  }
  printf("%d\n", num);
}
