Input: Sentence: 'A man with his hair in a top knot watches something while a group gathers by a fence'. Count the number of nouns in this sentence.
Output: 5