#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  long long k, sum = 0;
  string str;
  cin >> k;
  cin.ignore();
  cin >> str;
  for (int i = 0; i < str.length(); i++) {
    sum += str[i] - '0';
  }
  sort(str.begin(), str.end());
  long long diff = k - sum;
  if (sum >= k) {
    cout << 0;
    return 0;
  }
  long long ans = 0;
  for (int i = 0; i < str.length(); i++) {
    diff -= '9' - str[i];
    ans++;
    if (diff <= 0) break;
  }
  cout << ans;
  return 0;
}
