Problem9122--ABC336 —— E - Digit Sum Divisible

9122: ABC336 —— E - Digit Sum Divisible

[Creator : ]
Time Limit : 1.000 sec  Memory Limit : 512 MiB

Description

The digit sum of a positive integer $n$ is defined as the sum of the digits in the decimal notation of $n$. For example, the digit sum of $2024$ is $2+0+2+4=8$.  
A positive integer $n$ is called a good integer when $n$ is divisible by its digit sum. For example, $2024$ is a good integer because it is divisible by its digit sum of $8$.  
You are given a positive integer $N$. How many good integers are less than or equal to $N$?

Input

The input is given from Standard Input in the following format:

```
$N$
```

Output

Print the number of good integers less than or equal to $N$.

Constraints

-   $1 \leq N \leq 10^{14}$
-   $N$ is an integer.

Sample 1 Input

20

Sample 1 Output

13
There are 13 good integers less than or equal to 2020: 1,2,3,4,5,6,7,8,9,10,12,18,20.

Sample 2 Input

2024

Sample 2 Output

409

Sample 3 Input

9876543210

Sample 3 Output

547452239

HINT

相同题目:ABC336

Source/Category