Input: Sentence: 'A person in a hat is riding a horse'. Count the number of nouns in this sentence.
Output: 3