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 cupcakes 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 cupcakes you are carrying, but as they are kind trolls, they each give you back a single cupcake.
How many cupcakes do you have to leave home with to make sure that you arrive at Grandma’s with exactly 2 cupcakes?