#include <bits/stdc++.h>
using namespace std;
inline bool comp(const pair<pair<int, int>, int> &a,
                 const pair<pair<int, int>, int> &b) {
  return (a.second > b.second);
}
long long int MOD = 1e9 + 7;
int n, x[1000005], p = 1;
long long a, s;
vector<long long> v;
unordered_map<char, int> fir, lst;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long k, ch = 0, sum = 0;
  string s;
  cin >> k >> s;
  for (int i = 0; i < s.length(); i++) sum += s[i] - '0';
  sort(s.begin(), s.end());
  while (sum < k) {
    sum += 9 - (s[ch++] - '0');
  }
  cout << ch << endl;
  return 0;
}
