Recently I came across this question in a coding contest:

Given two integers x,y. Print the count of numbers in between x and y which are not divisible by a perfect square

1 <= x,y <= 10^9

0 <= |x-y| <= 10^6

what is the approach for this type of questions?