Input: Sentence: 'Man poses for picture with his dog while sitting on a bench'. Count the number of nouns in this sentence.
Output: 4