#include <bits/stdc++.h>
using namespace std;
const int MAXN = 200100;
long long k;
char s[MAXN];
int main() {
  while (cin >> k >> s) {
    long long sz = strlen(s), total = 0;
    sort(s, s + sz);
    for (int i = 0; i < (int)(sz); i++) total += (s[i] - '0');
    int pos = 0, cnt = 0;
    while (total < k && pos < sz) {
      total += ('9' - s[pos]);
      pos++;
      cnt++;
    }
    cout << cnt << endl;
  }
}
