Top three will always finish 1st, 2nd or 3rd, so top 3 must go through in each race all the way down.
25 horses = 5 races = 15 remain
15 horses = 3 races = 9 remain
9 horses = 2 races = 6 remain
Thats 10 races so far.
For the 6 horses remaining...
The winner of either race in the previous round auto qualifies for final, as even if all the top 3 were in the other race it will be found out in the final round.
Therefore penultimate round is one race of 5, with first three progressing plus + auto qualifier for a final race of 4 to deternime the top 3.