#include <bits/stdc++.h>
using namespace std;
template <typename T1, typename T2, typename T3>
struct triple {
  T1 a;
  T2 b;
  T3 c;
  triple() : a(T1()), b(T2()), c(T3()){};
  triple(T1 _a, T2 _b, T3 _c) : a(_a), b(_b), c(_c) {}
};
template <typename T1, typename T2, typename T3>
bool operator<(const triple<T1, T2, T3> &t1, const triple<T1, T2, T3> &t2) {
  if (t1.a != t2.a)
    return t1.a < t2.a;
  else if (t1.b != t2.b)
    return t1.b < t2.b;
  else
    return t1.c < t2.c;
}
using namespace std;
void solve() {
  long long n, m, k, a, x, q, y, z, ct = 0, sum = 0, prev = 0;
  string s;
  bool f = false;
  cin >> k >> s;
  n = s.length();
  long long diff[s.length()];
  for (int i = 0; i < s.length(); i++) {
    sum += (long long)(s[i] - '0');
    diff[i] = '9' - s[i];
  }
  sort(diff, diff + n, greater<int>());
  if (sum >= k)
    cout << 0;
  else {
    long long i = 0;
    while (sum < k) {
      sum += diff[i];
      ct++;
      i++;
    }
    cout << ct;
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long t = 1;
  while (t--) solve();
  return 0;
}
