B2. How many four-digit numbers are there with the following properties:

- the second digit is the average of the first digit and the third digit,
- the third digit is the average of the second digit and the fourth digit? (A number does not start with the digit 0.)
B2. The four digits of the number must form an arithmetic sequence. We count the number systematically:

- first the numbers $1111,2222, \ldots, 9999$. There are nine of these
- then the numbers 1234, 2345, 3456, ... , 6789 and 9876, 8765, .. ,4321, 3210. There are thirteen of these.
- next the numbers 1357, 2468, 3579 and 9753, 8642, 7531, 6420. There are seven of these.
- finally, only the number 9630 remains.

In total, there are $9+13+7+1=30$.