LogiQuest

269. Minimum Notes (Indian Currency)

EasyGreedy

Using notes/coins of ₹2000, 500, 200, 100, 50, 20, 10, 5, 2 and 1, print the minimum number needed to pay n rupees.

Input format

A single integer n.

Output format

The minimum count.

Example 1

Input

2786

Output

8

Example 2

Input

1

Output

1

Constraints

1 ≤ n ≤ 10⁹

Read input from standard input and print the answer to standard output. Your code is judged against 5 test cases, most of them hidden.

Loading the MyLoginn IDE…