#include <bits/stdc++.h>
using namespace std;
const int N = 1234567;
const int mod = 1e9 + 7;
int main() {
  int k;
  string s;
  cin >> k >> s;
  int l = s.length();
  long long sum = 0;
  for (int i = 0; i < l; i++) sum += s[i] - '0';
  vector<int> v;
  for (int i = 0; i < l; i++) {
    v.push_back(s[i] - '0');
  }
  sort(v.begin(), v.end());
  if (k <= sum)
    cout << 0 << endl;
  else {
    int d = k - sum;
    int ans = 0;
    for (int val : v) {
      if (val < 9) {
        int get = 9 - val;
        d -= get;
        ans++;
        if (d <= 0) break;
      }
    }
    cout << ans << endl;
  }
  return 0;
}
