Given that three dice are thrown.
The total number of outcomes when three dice are thrown together is 63=6×6×6.
The number of outcomes such that all the outcomes are different is =6×5×4.
For ex: If the outcome in dice 1 is "6" then the number of outcomes for dice 2 should be 5(1,2,3,4,5) which excludes the outcome "6".
Hence, the required probability is =6×6×66×5×4
=3620=95=qp
⇒q−p=9−5=4
Therefore, the required answer is 4.