#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long p = 0, ans = 0, t, k;
  cin >> k;
  string s;
  cin >> s;
  for (long i = 0; i < s.length(); i++) p += s[i] - '0';
  priority_queue<long, vector<long>, greater<long>> pq;
  for (long i = 0; i < s.length(); i++) pq.push(s[i] - '0');
  while (p < k) {
    t = pq.top();
    pq.pop();
    pq.push(9);
    p = p - t + 9;
    ans++;
  }
  cout << ans;
}
