#include <bits/stdc++.h>
using namespace std;
long long int x, y;
long long int gcd(long long int a, long long int b) {
  if (a == 0) {
    x = 0, y = 1;
    return b;
  }
  long long int gc = gcd(b % a, a);
  long long int temp;
  temp = x;
  x = y - (b / a) * temp;
  y = temp;
  return gc;
}
int main() {
  ios::sync_with_stdio(false);
  cout.tie(0);
  cin.tie(0);
  int k;
  long long int val = 0;
  string second;
  cin >> k >> second;
  int n = second.size();
  int i;
  sort(second.begin(), second.end());
  for (i = 0; i < n; i++) {
    val += (second[i] - 48);
  }
  if (val < k) {
    i = 0;
    while (val < k && i < n) {
      val += (9 - (second[i] - 48));
      i++;
    }
    cout << i << endl;
  } else {
    cout << 0;
  }
}
