#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
int a[N];
int main() {
  ios_base ::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int k;
  string s;
  cin >> k >> s;
  int sum = 0;
  for (auto it : s) {
    sum += it - '0';
  }
  sort(s.begin(), s.end());
  int i = 0;
  while (sum < k) {
    sum -= s[i] - '0';
    s[i] = '9';
    sum += s[i] - '0';
    i++;
  }
  cout << i;
}
