4. We will call a ticket with a number from 0001 to 2014 excellent if the difference between some two adjacent digits of its number is 5. Find the number of excellent tickets.
Solution. The number of excellent tickets from 0001 to 2014 is equal to the number of excellent tickets from 0000 to 2014. First, let's calculate the number of non-excellent tickets from 0000 to 2014.

The number of non-excellent tickets from 0000 to 1999 can be found as follows. Let $a_{1} a_{2} a_{3} a_{4}$ be the number of a non-excellent ticket. Then, $a_{1}$ can be chosen as two digits: 0 and 1.

$a_{2}$ can be chosen as any digit except those forming pairs 0-5, 1-6, i.e., any of 9 digits.

$a_{3}, a_{4}$ can be chosen as any digit except those forming pairs 0-5, 1-6, 2-7, 3-8, 4-9, i.e., any of 9 digits.

In total, there will be $2 \cdot 9 \cdot 9 \cdot 9=1458$ tickets.

In tickets from 2000 to 2014, there are fourteen non-excellent tickets (all except 2005).

Thus, we get 1458+14=1472 - non-excellent, therefore, 2015-1472=543 excellent tickets from 0000 to 2014, which means there are also 543 excellent tickets from 0001 to 2014.

Answer: 543.