#include <bits/stdc++.h>
using namespace std;
const int MAXN = (int)(1e5 + 1e1);
const double PI = acos(-1.0);
long long n, ans, k, i;
string s, t;
int main() {
  cin >> k >> s;
  for (int i = 0; i < (int)(s.length()); i++) n += (s[i] - '0');
  sort(s.begin(), s.end());
  while (n < k) {
    n += (9 - (s[i] - '0'));
    i++;
    ans++;
  }
  cout << ans;
  return 0;
}
