#include <bits/stdc++.h>
using namespace std;
int hako[11];
int main(void) {
  long long int k, res, tmp;
  char c;
  vector<char> st;
  cin >> k;
  tmp = 0;
  while (cin >> c) {
    st.push_back(c);
    tmp += c - '0';
    hako[c - '0']++;
  }
  if (tmp >= k) {
    cout << 0 << endl;
    return 0;
  }
  res = 0;
  for (int i = 0; i <= 9; i++) {
    for (int j = 0; j < hako[i]; j++) {
      tmp += 9 - i;
      res++;
      if (tmp >= k) {
        cout << res << endl;
        return 0;
      }
    }
  }
  cout << "muri" << endl;
  return 0;
}
