LastPage
whose number is right (after sufficiently many
passes through LaTeX, of course). The memoir class also
defines a “last page” label.
The documentation of the fancyhdr package spells out exactly
how one might actually use this information to produce page numbering
as suggested in the question.
This question on the Web: http://www.tex.ac.uk/cgi-bin/texfaq2html?label=nofm