시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
3 초 256 MB 1 1 1 100.000%

문제

Since mass transit was invented, people who buy tickets look for lucky ticket numbers. There are many notions of lucky tickets, for example sometimes tickets are considered lucky if the sum of first half of the digits is equal to the sum of the second half, sometimes the product is used instead of the sum, sometimes permutation of digits is allowed, etc.

In St Andrewburg integer numbers from 1 to n are used as ticket numbers. Bill considers a ticket lucky if its number is divisible by the sum of its digits. Help Bill to find the number of lucky tickets.

입력

The first line of the input file contains n (1 ≤ n ≤ 1012).

출력

Output one number — the number of lucky tickets.

예제 입력 1

100

예제 출력 1

33