Open the footer and, after the Page x, type ' of ', then press Ctrl-F9 to create an empty field (ie '{}') and type 'NUMPAGES'
between the field braces, so that you get '{NUMPAGES}', then select the field and press F9 to update it. When you're done, close the
footer to return to the body of the document.