Input: Sentence: 'A man riding on the back of a gray elephant'. Count the number of nouns in this sentence.
Output: 3