Олимпиадный тренинг

Задача 39747. 16-12


Задача

Темы: ЕГЭ
The algorithm for calculating the value of the function F(n), where n – natural number, given by the following relations:

F(0) = 12;
F(n) = 21 + f(n/5)
if n > 0, and the number n is a multiple of 5;
F(n) = 1 + f(n/2) otherwise.

Determine how many distinct values n,  belonging to the segment [1, 1000000], the function F(n)=37?
The sign / - means the operation of integer division.