You need to be more specific as what you are the referring to when you ask, "What is the rule of grammar?" You have divided the sentence incorrectly: "The shepherd counted his sheep / and found / that one of them is missing."