There are 40 animals at a petting zoo, all of which are goats or rabbits, and each animal is either an adult or a child. There are twice as many adult rabbits as adult goats, and three times as many child goats as adult goats. If there are exactly as many adult rabbits as there are child rabbits, then how many adult goats are in the petting zoo?