Input: Sentence: 'A train carrying boxes passes through the city'. Count the number of nouns in this sentence.
Output: 3