You're about to leave for an international vacation where you'll be visiting ten different foreign countries. To make sure you don't catch any local diseases, your doctor has given you ten pills and instructed you to take one as you arrive in each country. The pills all contain different medicines, so very it's important that you take the pills in the right order.
Unfortunately, the ten pills are all identical. Fortunately, you also have ten pill bottles you can put them in. Unfortunately, the pill bottles are also all identical, and there's no way for you to carry them without them getting jumbled up. Fortunately, your doctor also has a machine that can print out little stickers with whatever positive whole numbers you want on them which you can use to label your pills and bottles. Unfortunately, those stickers each cost \$100 times the number printed on them (e.g., a sticker labelled "9" would cost \$900), and official, intact stickers are the only thing that international customs will permit you to use to label your medications with.
Given all of that, how can you use those things to reliably distinguish which pill you need to take at each step in your itinerary without spending any more on stickers than you have to?
(I have an answer to this, but I don't know whether or not it's optimal. I'm curious whether or not anyone can find a better solution than mine.)