Some natural number was written on the board. Its sum of digits was not less than k. But you were distracted a bit, and someone changed this number to n, replacing some digits with others. It’s known that the length of the number didn’t change.
You have to find the minimum number of digits in which these two numbers can differ.
Input
The first line contains integer k (1 ≤ k ≤ 109).
The second line contains integer n (1 ≤ n < 10100000).
There are no leading zeros in n. It’s guaranteed that this situation is possible.
Output
Print the minimum number of digits in which the initial number and n can differ.
Examples
Input
3
11
Output
1
Input
3
99
Output
0
Note
In the first example, the initial number could be 12.
In the second example the sum of the digits of n is not less than k. The initial number could be equal to n.
#include<iostream>
#include<cstring>
#include<cstdio>
using namespace std;
int main()
{
int k,i,j;
char str[100000];
while(cin>>k){
cin>>str;
int w=0,sum=0,num=0;
int len=strlen(str);
for(i=0;i<len;i++)
{
sum+=str[i]-'0';
}
if(sum>=k)
{
cout<<w<<endl;
}
else
{
for(int l=0;l<9;l++)
{
for(j=0;j<len;j++)
{
if(str[j]-'0'==num)
{
sum+=9-num;
w++;
}
if(sum>=k)
{
break;
}
}
if(sum>=k)
{
cout<<w<<endl;
break;
}
num++;
}
}
}
return 0;
}