5. The amount in rubles that each tourist paid for a set of souvenirs is expressed by a number of the form $a^{2}$, where $a$ is the number of souvenirs or the price of one souvenir in rubles. Since the squares of natural numbers can only end in the digits $1,4,5,6,9$, there can only be 5 different changes, namely 9 p., 6 p., 5 p., 4 p., and 1 p. The maximum possible number of tourists is 5.
5. Tourists from one of the groups bought various souvenirs, with each of them taking a set of souvenirs of the same cost and as many as the cost of one souvenir in rubles. All tourists paid with ten-ruble bills (one or several), and each received change that did not match the change received by any of the other tourists. What change could each tourist have received, and what is the maximum number of tourists that could have been in the group?