#include <bits/stdc++.h>
using namespace std;
int k;
char s[100010];
int a[100010];
int main() {
  cin >> k;
  scanf("%s", s);
  int len = strlen(s);
  for (int i = 0; i < len; i++) {
    a[i] = s[i] - '0';
    k -= a[i];
    a[i] = 9 - a[i];
  }
  sort(a, a + len);
  int ans = 0;
  for (int i = len - 1; i >= 0; i--) {
    if (k > 0)
      k -= a[i], ans++;
    else
      break;
  }
  cout << ans;
  return 0;
}
