#include <bits/stdc++.h>
using namespace std;
double mark[10];
int main() {
  long long n, sum = 0, ans = 0;
  cin >> n;
  string s;
  cin >> s;
  for (long long i = 0; i < s.length(); i++) {
    int t = s[i] - 48;
    sum += t;
    if (sum >= n) {
      cout << 0 << endl;
      return 0;
    }
    mark[s[i] - 48]++;
  }
  n = n - sum;
  ans += min(ceil(n / 9.0), mark[0]);
  n = n - (9 * (min(ceil(n / 9.0), mark[0])));
  if (n <= 0) {
    cout << ans << endl;
    return 0;
  }
  ans += min(ceil(n / 8.0), mark[1]);
  n = n - (8 * (min(ceil(n / 8.0), mark[1])));
  if (n <= 0) {
    cout << ans << endl;
    return 0;
  }
  ans += min(ceil(n / 7.0), mark[2]);
  n = n - (7 * (min(ceil(n / 7.0), mark[2])));
  if (n <= 0) {
    cout << ans << endl;
    return 0;
  }
  ans += min(ceil(n / 6.0), mark[3]);
  n = n - (6 * (min(ceil(n / 6.0), mark[3])));
  if (n <= 0) {
    cout << ans << endl;
    return 0;
  }
  ans += min(ceil(n / 5.0), mark[4]);
  n = n - (5 * (min(ceil(n / 5.0), mark[4])));
  if (n <= 0) {
    cout << ans << endl;
    return 0;
  }
  ans += min(ceil(n / 4.0), mark[5]);
  n = n - (4 * (min(ceil(n / 4.0), mark[5])));
  if (n <= 0) {
    cout << ans << endl;
    return 0;
  }
  ans += min(ceil(n / 3.0), mark[6]);
  n = n - (3 * (min(ceil(n / 3.0), mark[6])));
  if (n <= 0) {
    cout << ans << endl;
    return 0;
  }
  ans += min(ceil(n / 2.0), mark[7]);
  n = n - (2 * (min(ceil(n / 2.0), mark[7])));
  if (n <= 0) {
    cout << ans << endl;
    return 0;
  }
  ans += min(ceil(n / 1.0), mark[8]);
  n = n - (1 * (min(ceil(n / 1.0), mark[8])));
  if (n <= 0) {
    cout << ans << endl;
    return 0;
  }
}
