You are on your way to visit your Grandma, who lives at the end of the valley. It's her anniversary, and you want to give her the cakes you've made. Between your house and her house, you have to cross 5 bridges, and as it goes in the land of make-believe, there is a troll under every bridge! Each troll, quite rightly, insists that you pay a troll toll. Before you can cross their bridge, you have to give them half of the cakes you are carrying, but as they are kind trolls, they each give you back a single cake.
How many cakes do you have to leave home with to make sure that you arrive at Grandma's with exactly 2 cakes?