QOJ.ac

QOJ

Límite de tiempo: 2 s Límite de memoria: 1024 MB Puntuación total: 100

#23880. Digit Sum

Estadísticas

Problem Statement

JOI-kun initially had a certain integer between $1$ and $N$, inclusive. After JOI-kun performed the following operation $0$ or more times, the integer he had became $N$:

  • Add the sum of the digits of his current integer when represented in base $10$ to his current integer.

Given $N$, write a program to find the number of integers that JOI-kun could have had initially.

Constraints

  • $1 \le N \le 1\,000\,000$.
  • $N$ is an integer.

Input

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

N

Output

Output the number of integers that JOI-kun could have had initially on $1$ line.

Sample 1

Input

13

Output

4

For example, if JOI-kun initially had the integer $5$ and performed the operation $3$ times, it changes as $5 \to 10 \to 11 \to 13$. There are only $4$ integers that JOI-kun could have had initially: $5, 10, 11, 13$.

Sample 2

Input

20

Output

1

Sample 3

Input

2019

Output

449

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.