#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9 + 5;
int main() {
  int k;
  cin >> k;
  string second;
  cin >> second;
  long long sum = 0;
  vector<int> a;
  for (int i = 0; i < second.size(); i++) {
    sum += second[i] - 48;
    a.push_back(second[i] - 48);
  }
  sort((a).begin(), (a).end());
  if (sum < k) {
    int cnt = 0;
    for (int i = 0; i < a.size(); i++) {
      int d = 9 - a[i];
      if (sum + d < k && d > 0) {
        sum += d;
        cnt++;
      } else {
        d = k - sum;
        if (d != 0) cnt++;
        break;
      }
    }
    cout << cnt;
  } else
    cout << 0;
}
