Input: Sentence: 'A herd of cattle and horses roaming freely in a field'. Count the number of nouns in this sentence.
Output: 4