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 ≤ 10^9).

The second line contains integer n (1 ≤ n < 10^100000).

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.

Difficulty: interview

Starter code:

Solutions:
k = int(input())
n = input()
digit = [0]*10
for c in n:
    digit[int(c)]+= 1
dsum = sum(i*digit[i] for i in range(10))

i = 0
change = 0
while dsum < k:
    if digit[i] == 0:
        i+= 1
        continue
    digit[i]-= 1
    digit[9]+= 1
    change+= 1
    dsum+= 9-i
print(change)

k = int(input());
n = int(input());
s = str(n);

arr = [int(x) for x in s];
arr.sort();
su = 0;
for i in range(len(arr)):
    su += arr[i];
tf = 0;
for i in range(len(arr)):
    if su >= k:
        break;
    else:
        su += 9-arr[i];
        tf += 1;

print(tf);


from sys import stdin, stdout

k = int(stdin.readline().rstrip())
n = int(stdin.readline().rstrip())

nList = list(map(int,list(str(n))))

nList.sort()
currentSum = sum(nList)

i=0
while currentSum<k:
    currentSum+=(9-nList[i])
    i+=1

print(i)


"""
Codeforces Round 427 Div 2 Problem B

Author  : chaotic_iak
Language: Python 3.5.2
"""

################################################### SOLUTION

def main():
    k, = read()
    n = input()
    s = [0]*10
    for c in n:
        s[ord(c)-48] += 1
    k -= sum(i*s[i] for i in range(10))
    ct = 0
    for i in range(9):
        if k <= 0: return ct
        tm = min(s[i], (k+9-i-1)//(9-i))
        ct += tm
        k -= tm*(9-i)
    return ct

#################################################### HELPERS

def read(callback=int):
    return list(map(callback, input().strip().split()))

def write(value, end="\n"):
    if value is None: return
    try:
        if not isinstance(value, str):
            value = " ".join(map(str, value))
    except:
        pass
    print(value, end=end)

write(main())


k,n=int(input()),input()
n=list(map(int,sorted(list(n))))
s=sum(n)-len(n)*int('0')
if s>=k:
	print("0")
else:
	for i in range(len(n)):
		s+=9-(n[i]-int('0'))
		if s>=k:
			print(i+1)
			break

k = int(input())
n = input()
l = []
s = 0
for i in range(len(n)):
    l.append(int(n[i]))
    s += int(n[i])
l.sort()
if s >= k:
    print(0)
else:
    term = 0
    while s < k:
        s += (9-l[term])
        term += 1
    print(term)


a = int(input())
digits = sorted(map(int, list(input())))
b = sum(digits)
n = 0
while b < a:
    b += 9 - digits[n]
    n += 1
print(n)

k = int(input())
n = list(map(int, sorted(input())))

s = sum(n)
idx = 0
res = 0

while k > s:
    s += 9 - n[idx]
    res += 1
    idx += 1

print(res)


k=int(input())
inp=input()
n=[]
for val in inp:
	n.append(int(val)) 
n.sort()
sumval=sum(n)
counter=0
for val in n:
	if(sumval<k):
		sumval+=9-val
		counter+=1
	else:
		break
print(counter)

from math import *

k = int(input())
s = input()
k2 = min(k, sum(map(int, s)))
l = list(map(int, sorted(s)))

i = 0
while k2 < k:
	k2 += 9 - l[i]
	i += 1

print(i)

k = int(input())
a = sorted([int(i) for i in input()])

s = sum(a)
ans = 0

while s < k:
    s += 9 - a[ans]
    ans += 1

print(ans)


k = int(input())
n = list(map(int, list(input())))
a = [n.count(i) for i in range(10)]
s = sum(n)
ans = 0
i = 0
while s < k:
    while a[i] > 0 and s < k:
        a[i] -= 1
        a[9] += 1
        s += 9 - i
        ans += 1
    i += 1
print(ans)

k = int(input())
num = [int(i) for i in input()]


num.sort()
q = k - sum(num)
w = 0
while q > 0:
       q -= 9 - num[w]
       w += 1
print(w)

from sys import stdin, stdout


k = int(stdin.readline().rstrip())
n = stdin.readline().rstrip()

n = sorted(n)

ck = 0
for c in n:
    ck += ord(c) - ord('0')

if ck >= k:
    print(0)
else:
    rez = 0
    for c in n:
        ck += ord('9') - ord(c)
        rez += 1
        if ck >= k:
            print(rez)
            break

def main():
    k = int(input())
    s = list(input())
    n = len(s)
    d = [0] * 10
    for i in range(n):
        d[int(s[i])] += 1
    a = 0
    for i in range(10):
        a += i * d[i]
    if k <= a:
        print(0)
        return
    i = 0
    c = 0
    while k > a:
        if d[i] == 0:
            i += 1
            continue
        a += 9 - i
        d[i] -= 1
        c += 1
    print(c)


main()


k = int(input())
d = list(map(int, list(input())))
d.sort()
l = sum(d)
i = 0
while l < k:
    l += 9 - d[i]
    i += 1
print(i)





k = int(input())
n = sorted(map(int, input()))
s = sum(n)
ans = 0
nk = 0
k = k - s
while nk < k and ans < len(n):
    nk += 9 - n[ans]
    ans += 1
print(ans)

k = int(input())
n = input()

data = []
for c in n:
    data.append(int(c))
data.sort()

sum_digits = sum(data)
if sum_digits >= k:
    print(0)
else:
    count = 0
    for i in data:
        sum_digits += (9 - i)
        count += 1
        if sum_digits >= k:
            break
    print(count)


k = int(input())
d = [0]*10
s = input().strip()
for v in s:
  d[int(v)] += 1
res = 0
for i,v in enumerate(d):
  k -= i*v
if k < 0: k = 0  
for i,v in enumerate(d):
  if k > (9-i)*v:
    k -= (9-i)*v
    res += v
  else:
    res += (k-1) // (9-i) + 1
    break
print(res)    

def main():
    k = int(input())
    n = [int(i) for i in input()]
    s = sum(n)
    n.sort()
    an = 0
    sm = 0
    if s >= k:
        print(0)
    else:
        while sm < k - s:
            sm += 9 - n[an]
            an += 1
        print(an)

main()

k = int(input())
n = sorted(map(int, list(input())))
s = sum(n)
c = 0
if s < k:
    for i in n:
        s = s - i + 9
        c += 1
        if s >= k:
            break
print(c)


k = int(input())
n = [int(i) for i in input()]
s = sum(n)
n.sort()
i=0
while i<len(n) and s<k:
    s+=9-n[i]
    i+=1 
print(i)


from bisect import bisect_left, bisect_right
from sys import stdin as fin
# fin = open("cfr427b.in", "r")

k, n = int(fin.readline()), [int(sym) for sym in fin.readline().rstrip()]
# print(tuple(int(sym) for sym in fin.readline().rstrip()))
# print(tuple(int(sym) for sym in fin.readline().rstrip()))
dsum = sum(n)
n.sort()
i = 0
while dsum < k:
    dsum += 9 - n[i]
    i += 1
print(i)

k = int(input())
n = list(map(int, list(input().strip())))
n.sort()
s = sum(n)
c = 0
i = 0
while s<k:
	s += 9 - n[i]
	i += 1
	c += 1
print(c)


# your code goes here
k = int(input())
starr = list(input())
n = len(starr)
sum = 0
for i in range(n):
	starr[i] = int(starr[i])
	sum += starr[i]
#print(starr)
starr.sort()
#print(starr)
ctr = 0
for a in starr:
	if sum >= k:
		break
	sum -= a
	sum += 9
	ctr += 1
print(int(ctr))