Five friends all brought some cakes with them when they met. Each of them gave a cake to each of the others. They then ate all the cakes they had just been given. As a result, the total number of cakes they had between them decreased by half. How many cakes did the five friends have at the start?