Cool pairs

In this problem, we will say that a pair of integer numbers (x,y)(x, y) is cool if y=x+1y = x + 1, and both xx and yy are perfect squares or perfect cubes. For instance, (8,9)(8, 9) is a cool pair, because xx is a perfect cube (8=238 = 2^3) and yy is a perfect square (9=329 = 3^2). As another example, (0,1)(0, 1) is a cool pair as well (a bit special, since 0 and 1 are perfect squares and also perfect cubes).

Given an interval [,r][\ell, r], how many cool pairs does it contain?

Input

Input consists of several cases, each one with \ell and rr. Assume 0<r10180 \le \ell < r \le 10^{18}.

Output

For every case, print the number of cool pairs with xx and yy inside [,r][\ell, r].

Problem information

Author: Salvador Roura

Generation: 2026-01-25T10:21:39.406Z

© Jutge.org, 2006–2026.
https://jutge.org