跳到主要内容
图灵 OJTURING / ONLINE JUDGE

#F0672. The number on the board

    ID: 678 传统题 2000ms 256MiB 尝试: 0 已通过: 0 难度: 2 上传者: 标签>贪心算法思想基础难度共享题库Codeforces英文题面题目来源题面语言

The number on the board

题目描述

B. The number on the board
time limit per test
2 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output

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.


题目来源:fps-www.educg.net-codeforce-1-2833.xml.zip;FPS 共享题包,题包内第 86 题。保留原作者与原赛事署名。