cho.sh
Notes
Loading...

Hansu Numbers

Time limit

2s

Memory limit

128 MB

Problem

A positive integer X is called a Hansu number if its digits form an arithmetic sequence. In other words, the differences between every pair of adjacent digits are all the same. Given a natural number N, count how many integers from 1 through N are Hansu numbers.

Input

The first line contains a natural number N. N is at most 1,000.

Output

Print the number of Hansu numbers from 1 through N.