Input: Sentence: 'A man sits in a cart pulled by a horse'. Count the number of nouns in this sentence.
Output: 3