A positive integer X is an arithmetic digit number when its digits, read from left to right, form an arithmetic sequence. An arithmetic sequence is a sequence in which the difference between two neighboring terms is always the same. A sequence of one or two terms satisfies that condition, so every one-digit number and every two-digit number is an arithmetic digit number.
Given N, write a program that prints how many arithmetic digit numbers are at least 1 and at most N.