Input: Sentence: 'A cowboy riding a horse kicking up a lot of dirt'. Count the number of nouns in this sentence.
Output: 4