On a newly discovered planet, the animals that astronauts named are based on the number of legs they have, such as one-legged, two-legged, three-legged, etc. (no legless animals were found). Animals $\mathrm{s}$ with an odd number of legs have two heads, and animals with an even number of legs have one head. In a certain depression, the astronauts encountered a group of such animals and counted 18 heads and 24 legs.

How many animals could have been in the depression? Determine all possibilities.

(T. Bárta)

Hint. The number of heads and legs in the depression are even.
Since the total number of animal heads in the pit was even, the number of one-headed animals had to be even. Because one-headed animals have even numbers of legs, two-headed animals have odd numbers of legs, and the total number of legs was even, the number of two-headed animals also had to be even. Since there were a total of 24 legs, there could not be more than 12 one-headed animals.

Let the number of one-headed and two-headed animals in the pit be $j$ and $d$, respectively. The previous conclusions correspond to the requirements that $j$ and $d$ are positive even numbers and $j \leqq 12$. The information about the number of heads also means $j+2d=18$. All these requirements are met precisely by the following pairs of numbers:

$$
\begin{aligned}
& j=2,6,10, \\
& d=8,6,4 .
\end{aligned}
$$

For each of the given options, it is necessary to verify whether they could actually occur, i.e., whether there is an example of the counts of individual types of animals with the correct total number of legs:

- For $j=2$ and $d=8$, it could have been, for example, 2 quadrupeds, 4 unipedes, and 4 tripeds $(2 \cdot 4 + 4 \cdot 1 + 4 \cdot 3 = 24)$.
- For $j=6$ and $d=6$, it could have been, for example, 6 bipeds, 3 unipedes, and 3 tripeds $(6 \cdot 2 + 3 \cdot 1 + 3 \cdot 3 = 24)$.
- For $j=10$ and $d=4$, it could have been 10 bipeds and 4 unipedes $(10 \cdot 2 + 4 \cdot 1 = 24)$. There could have been 10, 12, or 14 animals in the pit.