#include <bits/stdc++.h>
using namespace std;
int main() {
  std::ios::sync_with_stdio(false);
  int k = 0;
  cin >> k;
  vector<short> numbers;
  int current_sum = 0;
  char c;
  while (cin >> c) {
    current_sum += atoi(&c);
    numbers.push_back(atoi(&c));
  }
  sort(numbers.begin(), numbers.end());
  int i = 0;
  while (current_sum < k) {
    current_sum += 9 - numbers[i];
    numbers[i] = 9;
    i++;
  }
  cout << endl << i;
}
