P26994 [AtCoder] Feel the Beat
普及
题目描述

Problem Description

BPM (Beat Per Minute) is a numerical value that represents the speed of a song.

Kenkoooo likes medium-speed songs with BPM between $140$ and $170$ (not including $170$). He also likes songs where dividing the BPM by $2$ several times results in a value between $140$ and $170$ (not including $170$). He does not like songs that do not meet either of these criteria.

For example, Kenkoooo likes a song with BPM $679$ (dividing by $2$ twice results in $169.75$), but he does not like a song with BPM $680$ (dividing by $2$ twice results in $170$).

Here is a CD with $D - C$ songs. The BPM of these songs are respectively $C, C+1, C+2, ..., D-2, D-1$. How many songs on this CD does Kenkoooo like?

Input Format

The input is given from the standard input in the following format:

$ C $ $ D $

Output Format

Output the number of songs on the CD that Kenkoooo likes.

Sample Input and Output

Sample Input #1

160 300

Sample Output #1

30

Sample Input #2

340 560

Sample Output #2

0

Sample Input #3

140 1000000000000000

Sample Output #3

263882790666210

Notes/Hints

Constraints

  • $140 \leq C < D \leq 10^{15}$
  • $C, D$ are integers.

Sample Explanation 1

In this example, the CD contains $140$ songs with BPM $160, 161, 162, ..., 298, 299$. Among these, Kenkoooo likes $10$ songs with BPM $160, 161, 162, ..., 168, 169$ and $20$ songs with BPM $280, 281, 282, ..., 298, 299$, totaling $30$ songs.

Sample Explanation 2

This album does not match Kenkoooo's preferences.

Sample Explanation 3

In Kenkoooo's world, the capacity of a CD is unlimited, and the number of songs recorded may not fit into a 32-bit integer.

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
160 300
样例输出
30