Input: Sentence: 'a man walking in the grass wearing a backpack'. Count the number of nouns in this sentence.
Output: 3