Input: Sentence: 'A man and a child having dinner at a restaurant'. Count the number of nouns in this sentence.
Output: 4