Input: Sentence: 'A group of men leaning over rail as a dog approaches them'. Count the number of nouns in this sentence.
Output: 4