#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios_base::sync_with_stdio(0);
  int k;
  cin >> k;
  string second;
  cin >> second;
  int n = second.size();
  multiset<int> Q;
  int summ = 0;
  for (int i = 0; i < n; i++) {
    summ += (second[i] - '0');
    Q.insert(second[i] - '0');
  }
  int ans = 0;
  while (k > summ) {
    auto it = Q.begin();
    Q.erase(Q.begin());
    summ += 9 - (*it);
    ans++;
  }
  cout << ans;
  return 0;
}
