Input: Sentence: 'A brown horse sticking its head out of a red and white barn door'. Count the number of nouns in this sentence.
Output: 4