Input: Sentence: 'Three men are riding a spotted elephant in the middle of the park'. Count the number of nouns in this sentence.
Output: 4