Finding number of perfect squares in a range