#include <bits/stdc++.h>
using namespace std;
string s;
int k, sum = 0;
int main() {
  cin >> k >> s;
  sort(s.begin(), s.end());
  for (int i = 0; i < s.size(); i++) sum += (s[i] - 48);
  int val = k - sum;
  int ans = 0, i = 0;
  while (val > 0) {
    ans++;
    val -= ('9' - s[i]);
    i++;
  }
  cout << ans;
  return 0;
}
