#include <bits/stdc++.h>
using namespace std;
int main() {
  int k;
  cin >> k;
  char n[100001];
  int a[100001] = {0};
  for (int i = 0; i < 100001; ++i) n[i] = '\0';
  cin >> n;
  int len = strlen(n);
  sort(n, n + len);
  int sum = 0;
  for (int i = 0; i < len; ++i) {
    a[i] = '9' - n[i];
    sum += n[i] - '0';
  }
  if (sum >= k) {
    cout << 0 << endl;
    return 0;
  }
  for (int i = 0; i < len; ++i) {
    sum += a[i];
    if (sum >= k) {
      cout << i + 1 << endl;
      return 0;
    }
  }
}
