import java.io.* ;
import java.util.* ;
public class EvenNumberOfDivisors {
try {
while ( ! st.hasMoreTokens ( ) ) {
if ( s == null )
return null ;
}
return st.nextToken ( ) ;
return null ;
}
}
long max = 10000000000000000L + 5 ;
long [ ] squares
= new long [ 1 + ( int ) ( Math .
sqrt ( max
) ) ] ; for ( long k = 1 ; k* k <= max; k++ ) {
squares[ ( int ) ( k- 1 ) ] = k* k;
}
while ( true ) {
long N
= Long .
parseLong ( next
( ) ) ; long M
= Long .
parseLong ( next
( ) ) ;
if ( N == 0 && M == 0 ) {
break ;
}
long size = M - N + 1 ;
long x = f( squares, N, M) ;
long ans = size - x;
out.println ( ans) ;
}
//
out.flush ( ) ;
}
// nuumber of values in range [L, R] where the value has odd number of divisor (perfect square)
static int f( long [ ] squares, long L, long R) {
int low = firstHigheer( squares, L) ;
int high = firstLower( squares, R) ;
// out.printf("f(%d, %d) = %d - %d\n", L, R, low, high );
return high - low + 1 ;
}
// the first index with value >= key
static int firstHigheer( long [ ] list, long key) {
int lo = 0 , hi = list.length - 1 ;
int ans = - 1 ;
while ( lo <= hi ) {
int mid = ( lo + hi) >> 1 ;
if ( list[ mid] >= key ) {
ans = mid; hi = mid - 1 ;
} else lo = mid + 1 ;
}
return ans;
}
// the last index with value <= key
static int firstLower( long [ ] list, long key) {
int lo = 0 , hi = list.length - 1 ;
int ans = - 1 ;
while ( lo <= hi ) {
int mid = ( lo + hi) >> 1 ;
if ( list[ mid] <= key ) {
ans = mid; lo = mid + 1 ;
} else hi = mid - 1 ;
}
return ans;
}
}
CmltcG9ydCBqYXZhLmlvLio7CmltcG9ydCBqYXZhLnV0aWwuKjsKCnB1YmxpYyBjbGFzcyBFdmVuTnVtYmVyT2ZEaXZpc29ycyB7CgoJc3RhdGljIEJ1ZmZlcmVkUmVhZGVyIGJyID0gbmV3IEJ1ZmZlcmVkUmVhZGVyKG5ldyBJbnB1dFN0cmVhbVJlYWRlcihTeXN0ZW0uaW4pKTsKCXN0YXRpYyBQcmludFdyaX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