#include <bits/stdc++.h>
using namespace std;
int isprime(long long n) {
  if (n <= 3) return 1;
  if (n % 2 == 0 || n % 3 == 0) return 0;
  for (long long i = 5; i * i <= n; i += 6) {
    if (n % i == 0 || n % (i + 2) == 0) return 0;
  }
  return 1;
}
long long int exp(long long int value, long long int power) {
  long long int result = 1;
  while (power > 0) {
    if (power & 1LL) {
      result *= value;
      result %= 1000000007;
    }
    value *= value;
    value %= 1000000007;
    power /= 2LL;
  }
  return result;
}
long long a[1000005];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int sum, f, cnt, len, row, col, p, q, r, t, i, j, k, l, n, m, x, y,
      z, b, c;
  cin >> k;
  string st;
  cin >> st;
  l = st.size();
  sum = 0;
  for (i = 0; i < l; i++) {
    sum += (st[i] - 48);
    a[i] = 57 - st[i];
  }
  if (sum >= k) {
    cout << "0";
  } else {
    x = k - sum;
    sort(a, a + l);
    cnt = 0;
    i = l - 1;
    while (x > 0) {
      x -= a[i];
      cnt += 1;
      i--;
    }
    cout << cnt;
  }
  return 0;
}
