#include <bits/stdc++.h>
using namespace std;
priority_queue<int, vector<int>, greater<int> > pq;
int main() {
  int k;
  string n;
  long long mn = 10000000;
  long long a[100000];
  long long sum = 0;
  cin >> k;
  cin >> n;
  if (k > n.size() * 9) {
    cout << 0;
    exit(0);
  }
  for (int i = 0; i < n.size(); i++) {
    long long x = (int)n[i] - '0';
    pq.push(x);
    sum += x;
  }
  int h = k - sum;
  int d = 0;
  while (h > 0) {
    h -= (9 - pq.top());
    d++;
    pq.pop();
  }
  cout << d;
}
