#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long k;
  cin >> k;
  string s;
  cin >> s;
  long long n = s.length();
  char arr[n];
  long long sum = 0, sum1 = 0;
  for (long long i = 0; i < n; i++) {
    arr[i] = s[i];
    sum = sum + s[i] - 48;
  }
  sort(arr, arr + n);
  long long ans = 0;
  for (long long i = 0; i < n; i++) {
    if (sum < k) {
      sum = sum - arr[i] + '9';
      ans++;
    }
  }
  cout << ans << endl;
}
