Input: Sentence: 'A man in a cowboy hat is milking a black cow'. Count the number of nouns in this sentence.
Output: 4