#include <bits/stdc++.h>
using namespace std;
int main() {
  long long k, sum = 0;
  string x;
  cin >> k >> x;
  for (int i = 0; i < x.length(); i++) {
    sum += x[i] - '0';
  }
  sort(x.begin(), x.end());
  int v = 0;
  while (sum < k) {
    sum += '9' - x[v];
    v++;
  }
  cout << v << endl;
}
