Much is usually used when the noun is not countable, with the exception of money. Conversely, many is used for everything else, typically countable nouns. These sentences are all correct:
How much do I owe?
How much sand is on the beach?
How much water do you have?
How many Rubik's cubes do you own?
How many cubes can you solve?
How many electronic devices do you have?
So pretty much, if you can count if easily (like amounts of things) you use many. If you can't count it easily (sand, water, etc) you use much (with the exception of money). However, you do use many when referring to coins or bills, so "How many $2 bills do you have?" or "How many loonies do you have?" are both correct.
Note: In Canada we call a 1$ coin a loonie because it has a loon on it (no clue why but it does). We also call a $2 coin a toonie because it's fun to say XD