#B3743. Counting Zero Shadows

    ID: 11402 Type: Default 1000ms 256MiB

Counting Zero Shadows

Counting Zero Shadows

In this problem, we define the concept of zero shadows in digits. Some digits are said to have the shadow of zero. Specifically, the digits \(2, 6, 9, 0\) each contribute one zero shadow, while the digit \(8\) contributes two zero shadows. Given a non-negative number, your task is to count the total number of zero shadows present in its digits.

For example, consider the number 860:

  • The digit 8 contributes 2 zero shadows.
  • The digit 6 contributes 1 zero shadow.
  • The digit 0 contributes 1 zero shadow.
Thus, the total number of zero shadows is 4.

inputFormat

The input consists of a single line containing a non-negative number. The number can be very large, so it should be processed as a string.

outputFormat

Output the total number of zero shadows in the given number.

sample

860
4