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