A locomotive engine without a train can go 24 km an hour and its speed is diminished by a quantity, which varies as the square root of the number of wagons attached. With 4 wagons its speed is 20 km per hour. FInd the greatest number of wagons with which the engine can move.