Winter in Yekaterinburg is the longest time of the year. And everyone
spends long winter evenings in his own way. Software engineer Ivan likes
to work. So much that a perfect day for him is when he could spend the
whole day until late at night in his corner office, without being
distracted from writing code for all sorts of extraneous matter. The only
pity is his supervisors do not strongly support him in this, all the time
making him participate in all sorts of conversations and presentations.
From the first of January of the new year throughout the organization, it
was decided to introduce a new order of the staff reporting to the
supervisors. Every second day, each engineer should report to his immediate
supervisor. Of the remaining days, every third day — to the head of
his supervisor. Of the remaining days, every fourth day — to the head
of the head of his supervisor. And so on. The organization is very large,
so it can be assumed that for ordinary engineers there is an infinite
number of levels of supervising. Ivan is not happy about all this
bureaucracy, but he needs to learn to live with it. In particular, Ivan
needs to plan his vacation so that it would include as many reporting days
as possible and as little days, when he can work quietly, as possible.
Ivan wants to count how many quiet days will be during his scheduled
vacation in order to, possibly, move it to another time.
The first line contains integers l and r that are the numbers of the
first and the last scheduled days of Ivan’s vacation, counting from the
day of introduction of the new order in the company (1 ≤ l
≤ r ≤ 109).
Output the number of quiet days during scheduled vacation.
On the days with numbers 2, 4, 6, 8 and 10 Ivan will report to his
immediate supervisor. In the day 5 — to the head of his supervisor, in
the day 9 — to the head of the head of his supervisor. The days with
numbers 1, 3 and 7 are quiet.
Problem Author: Dmitry Ivankov
Problem Source: Open Ural FU Personal Contest 2014