Problem L. Long-term activity

Author:Антон Карабанов   Time limit:1 sec
Input file:Standard input   Memory limit:256 Mb
Output file:Standard output  

Statement

On the board, a natural number is written. Timofey wants to maximize this number, meaning he wants all nines to be at the beginning, followed by eights, and so on. In one operation, he can swap any two adjacent digits of the number. Determine the minimum number of operations he needs to achieve this goal.

Input format

A single line of input contains a natural number n.

Output format

Output a single non-negative integer, the answer to the problem.

Constraints

1 ≤ n ≤ 10100000.

Example explanation

Initial string: 2023.

1) 2032.

2) 2302.

3) 3202.

4) 3220.

Sample tests

No. Standard input Standard output
1
2023
4

0.085s 0.016s 13