#include <bits/stdc++.h>
using namespace std;
int main() {
  int k;
  string s;
  cin >> k >> s;
  vector<int> v;
  for (auto it : s) v.push_back(it - '0');
  sort(v.begin(), v.end());
  int sum = 0;
  for (auto it : v) sum += it;
  int x = 0;
  int diff = max(0, k - sum);
  while (diff > 0) {
    diff -= (9 - v[x]);
    x++;
  }
  cout << x << "\n";
  return 0;
}
