#include <bits/stdc++.h>
using namespace std;
bool debug = 1;
int main() {
  long long k;
  vector<long long> v;
  scanf("%lld", &k);
  string s;
  cin >> s;
  long long sum = 0;
  for (int i = 0; i < (s.size()); i++) {
    v.push_back(s[i] - '0');
    sum += v[i];
  }
  sort(v.begin(), v.end());
  int i = 0;
  long long ans = 0;
  while (i < v.size() and sum < k) {
    sum += (9 - v[i]);
    i++;
    ans++;
  }
  printf("%lld\n", ans);
  return 0;
}
