2. Ana sells pies at the market.

- In the first hour, she sold a quarter of the number of all the pies she brought and another quarter of the pies.
- In the second hour, she sold a fifth of the number of the remaining pies and another fifth of the pies.
- In the third hour, she sold a quarter of the number of the remaining pies and another quarter of the pies.
- In the fourth hour, she sold a quarter of the number of the remaining pies and another quarter of the pies.
- In the fifth hour, she sold a fifth of the number of the remaining pies and another fifth of the pies.

If it is known that Ana brought a whole number of pies, and that during each hour Ana sold a whole number of pies, determine the smallest possible number of pies that Ana could have brought to the market.
2. Let Ana initially have $n$ pies. After the first hour, she has $\frac{3 n-1}{4}$ pies left, after the second hour $\frac{4}{5} \frac{3 n-1}{4}-\frac{1}{5}$, i.e., $\frac{3 n-2}{5}$ pies, after the third hour $\frac{3}{4} \frac{3 n-2}{5}-\frac{1}{4}$, i.e., $\frac{9 n-11}{20}$ pies, after the fourth hour $\frac{3}{4} \frac{9 n-11}{20}-\frac{1}{4}$, i.e., $\frac{27 n-53}{80}$ pies, and after the fifth hour $\frac{4}{5} \frac{27 n-53}{80}-\frac{1}{5}$, i.e., $\frac{27 n-73}{100}$ pies. All these expressions must be integers, from which we can easily see that $n \equiv -1 \pmod{4,5,20,80,100}$, i.e., $n+1$ must be divisible by all the mentioned numbers. Since the least common multiple (LCM) of $(4,5,20,80,100)=400$, the last condition is equivalent to $400 \mid n+1$, and the smallest possible number of pies Ana could have brought is 399.