For the school birthday party, Ana, Pedro, Miriam, and Fábio brought a total of 90 sweets together. Their teacher observed that:

- if Ana had brought 2 more sweets;
- if Pedro had brought 2 fewer sweets;
- if Miriam had brought twice as many;
- if Fábio had brought half as many;

all four friends would have brought the same number of sweets. How many sweets did each friend bring?
Representing the number of sweets each of the 4 friends brought by the initial of their name, we have:

$$
\left\{\begin{array}{l}
A+P+M+F=90 \\
A+2=P-2=2 M=\frac{F}{2}
\end{array}\right.
$$

From the second equation, it follows that:

$$
P=A+4 \quad ; \quad M=\frac{A+2}{2} \quad ; \quad F=2(A+2)
$$

Substituting these values into the first equation, we get:

$$
A+A+4+\frac{A+2}{2}+2(A+2)=90 \Rightarrow 9 A=180-18 \Rightarrow A=18
$$

Therefore:

$$
P=18+4=22 ; M=\frac{18+2}{2}=10 \quad \text { and } \quad F=2(18+2)=40
$$