Input: Sentence: 'a cat with its head in a small purse'. Count the number of nouns in this sentence.
Output: 3