cows = y
pigs = y + 6
goats = 4(y+6) = 4y+ 24
sheep = 2/3 * (4y + 24) = 8/3y + 16
sol.
total
= y+y+6+4y+24+8/3y+16
=26/3y + 46
sheep = 112 = 8/3 y + 16
8/3y = 112-16
y= (112 - 16)*3/8
y = 36
then substitute y with 36 in the total equation so yeah...
36+36+6+4(36)+24+8/3(36)+16
=358 animals