#include <bits/stdc++.h>
using namespace std;
int main() {
  int k, rec[100100];
  char str[100100];
  while (cin >> k) {
    int cnt = 0, sum = 0, i;
    cin >> str;
    int t = strlen(str);
    for (i = 0; i < t; i++) rec[cnt++] = str[i] - '0';
    sort(rec, rec + cnt);
    for (i = 0; i < t; i++) sum += rec[i];
    if (sum >= k) {
      cout << "0" << endl;
      continue;
    }
    int pos = 0;
    while (sum < k) {
      sum += 9 - rec[pos++];
    }
    cout << pos << endl;
  }
  return 0;
}
