Example. Let's take one coin from each bag. Among these five coins, there are coins of all three types, so there is only one coin of a certain type. If it is, for example, a gold coin, then it was taken from the bag with gold coins. Indeed, for each coin from the "mixed" bag, there is a matching one from the corresponding "homogeneous" bag.

Evaluation. Suppose we took only 4 coins. Note that it makes no sense to take more than one coin from a bag, as they may turn out to be the same, and then we would not gain any additional information. Therefore, we can assume that we took one coin from each of four different bags. Then we could have taken coins 3, 3, S, B, and in this case, there are at least two possible distributions of the corresponding bags: 3, Mixed, S, Mixed, B and Mixed, 3, Mixed, B, S, which do not match in any of the positions (the last one indicates the bag from which no coins were taken).

## Answer

5 coins.
Evdokiyov M.A.

A pirate has five bags of coins, each containing 30 coins. He knows that one bag contains gold coins, another contains silver coins, a third contains bronze coins, and each of the two remaining bags contains an equal number of gold, silver, and bronze coins. You can simultaneously take any number of coins from any of the bags and see what kind of coins they are (coins are taken out only once). What is the smallest number of coins that need to be taken to definitely determine the contents of at least one bag?