Time limit
Memory limit
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.
The first line contains a natural number N. N is at most 1,000.
Print the number of Hansu numbers from 1 through N.