#include <bits/stdc++.h>
using namespace std;
int main() {
  long long k;
  cin >> k;
  getchar();
  char s[1000001];
  cin >> s;
  int a[strlen(s)];
  long long sum = 0;
  for (int i = 0; i < strlen(s); i++) {
    sum += s[i] - 48;
    a[i] = s[i] - 48;
  }
  k = k - sum;
  sort(a, a + strlen(s));
  int c = 0;
  for (int i = 0; i < strlen(s); i++) {
    if (k > 0) {
      k -= (9 - a[i]);
      c++;
    } else
      break;
  }
  cout << c << endl;
}
