#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  int k;
  string x;
  cin >> k >> x;
  sort(x.begin(), x.end());
  int sum = 0;
  for (int i = 0; i < x.length(); i++) sum += (x[i] - '0');
  int ans = 0;
  for (int i = 0; i < x.length(); i++) {
    if (sum >= k) break;
    sum -= (x[i] - '0');
    sum += 9;
    ans++;
  }
  printf("%d\n", ans);
  return 0;
}
