#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:100000000")
#pragma GCC optimize("O3")
using namespace std;
const long long N = 1e5 + 10;
const long long mod = 1e9 + 7;
const long long INF = 1e18;
const long long inf = -1e18;
const long long M = 5 * 1e8;
long long k, sum, ans, i;
string s;
int main() {
  cin >> k;
  cin >> s;
  for (int i = 0; i < s.size(); i++) {
    sum += (s[i] - '0');
  }
  sort(s.begin(), s.end());
  i = 0;
  while (sum < k && i < s.size()) {
    sum += 9 - (s[i] - '0');
    i++;
    ans++;
  }
  cout << ans;
  cin.get(), cin.get();
  return 0;
}
