Input: Sentence: 'Two birds are perching on top of tree branches'. Count the number of nouns in this sentence.
Output: 4