For what values of x does one write the number of x, the amount of x, or the quantity of x?
Number is used with plural nouns, things that can be counted.
Amount is normally used for nouns that can't be measured.
But it can also be used for things that can be measured (as @psmears points out below), especially money:
Quantity is used for nouns you can measure.
It is pretty much synonymous with number.
I was taught:
Much vs. Many
Fewer vs. Less
Amount vs. Number vs. Quantity
Use the words 'many', 'fewer', and 'number' when the object is countable (no matter how big that number may be.) "There are many creatures in the ocean."
Use the words 'much', 'less', and 'amount' when the object is measurable, but not countable. "There is much water in the ocean."
'Quantity' is more technical and can be used for both countable and uncountable things. "What is the quantity of water in the ocean?" "What is the quantity of whales in the ocean?"
"Mary bought fewer gallons of milk than Jane, therefor Mary has less milk than Jane."