1 #include <iostream> 2 #include <algorithm> 3 #include <cstring> 4 #include <cstdio> 5 #include <vector> 6 #include <cstdlib> 7 #include <iomanip> 8 #include <cmath> 9 #include <ctime> 10 #include <map> 11 #include <set> 12 using namespace std; 13 #define lowbit(x) (x&(-x)) 14 #define max(x,y) (x>y?x:y) 15 #define min(x,y) (x<y?x:y) 16 #define MAX 100000000000000000 17 #define MOD 1000000007 18 #define pi acos(-1.0) 19 #define ei exp(1) 20 #define PI 3.141592653589793238462 21 #define INF 0x3f3f3f3f3f 22 #define mem(a) (memset(a,0,sizeof(a))) 23 typedef long long ll; 24 ll gcd(ll a,ll b){ 25 return b?gcd(b,a%b):a; 26 } 27 const int N=100005; 28 const int mod=1e9+7; 29 char a[N]; 30 int main() 31 { 32 int k; 33 scanf("%d",&k); 34 scanf("%s",&a); 35 int len=strlen(a); 36 int s=0; 37 for(int i=0;i<len;i++){ 38 s+=a[i]-'0'; 39 } 40 sort(a,a+len); 41 if(s>=k) cout<<0<<endl; 42 else { 43 int t=0; 44 for(int i=0;i<len;i++){ 45 s+=9-(a[i]-'0'); 46 t++; 47 if(s>=k){ 48 break; 49 } 50 } 51 cout<<t<<endl; 52 } 53 return 0; 54 }