#include <bits/stdc++.h>
using namespace std;
const long long PR = 19260817;
const long long inv2 = 500000004;
const long long inv3 = 333333336;
int main() {
  string s;
  int n;
  int k;
  cin >> k;
  cin >> s;
  n = s.length();
  sort(s.begin(), s.end());
  int sum = 0;
  for (int i = 0; i < n; i++) sum += s[i] - '0';
  int cnt = 0;
  for (int i = 0; i < n && sum < k; i++) {
    if (s[i] == '9') continue;
    sum += '9' - s[i];
    cnt++;
  }
  cout << cnt << endl;
  return 0;
}
