Input: Sentence: 'The pet dog is allowed to sleep on his owners bed'. Count the number of nouns in this sentence.
Output: 3