Suppose all ostriches have 24x2=48 legs. In fact, it is 78-48=30 legs, and the extra legs must belong to sika deer. Because a deer has two legs equal to an ostrich, Gu's extra 30 legs divided by two is the number of sika deer.
54÷2= 15 deer
So 24- 15=9 ostriches.