{"trustable":true,"sections":[{"title":"","value":{"format":"HTML","content":"\u003cp\u003e \u003ci\u003eN\u003c/i\u003e (1 ≤ \u003ci\u003eN\u003c/i\u003e ≤ 100) cows, conveniently numbered 1..\u003ci\u003eN\u003c/i\u003e, are participating in a programming contest. As we all know, some cows code better than others. Each cow has a certain constant skill rating that is unique among the competitors.\u003c/p\u003e \u003cp\u003e The contest is conducted in several head-to-head rounds, each between two cows. If cow \u003ci\u003eA\u003c/i\u003e has a greater skill level than cow \u003ci\u003eB\u003c/i\u003e (1 ≤ \u003ci\u003eA\u003c/i\u003e ≤ \u003ci\u003eN\u003c/i\u003e; 1 ≤ \u003ci\u003eB\u003c/i\u003e ≤ \u003ci\u003eN\u003c/i\u003e; \u003ci\u003eA\u003c/i\u003e ≠ \u003ci\u003eB\u003c/i\u003e), then cow \u003ci\u003eA\u003c/i\u003e will always beat cow \u003ci\u003eB\u003c/i\u003e.\u003c/p\u003e \u003cp\u003e Farmer John is trying to rank the cows by skill level. Given a list the results of \u003ci\u003eM\u003c/i\u003e (1 ≤ \u003ci\u003eM\u003c/i\u003e ≤ 4,500) two-cow rounds, determine the number of cows whose ranks can be precisely determined from the results. It is guaranteed that the results of the rounds will not be contradictory.\u003c/p\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\u003cp\u003e For each test case:\u003c/p\u003e \u003cp\u003e * Line 1: Two space-separated integers: \u003ci\u003eN\u003c/i\u003e and \u003ci\u003eM\u003c/i\u003e\u003cbr\u003e * Lines 2..\u003ci\u003eM\u003c/i\u003e+1: Each line contains two space-separated integers that describe the competitors and results (the first integer, \u003ci\u003eA\u003c/i\u003e, is the winner) of a single round of competition: \u003ci\u003eA\u003c/i\u003e and \u003ci\u003eB\u003c/i\u003e\u003c/p\u003e \u003cp\u003e Process to the end of file.\u003c/p\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003cp\u003e For each test case:\u003c/p\u003e \u003cp\u003e * Line 1: A single integer representing the number of cows whose ranks can be determined\u003c/p\u003e"}},{"title":"Sample Input","value":{"format":"HTML","content":"\u003cdiv style\u003d\"font-family: courier new,courier,monospace\"\u003e\n 5 5\n \u003cbr\u003e 4 3\n \u003cbr\u003e 4 2\n \u003cbr\u003e 3 2\n \u003cbr\u003e 1 2\n \u003cbr\u003e 2 5\n\u003c/div\u003e"}},{"title":"Sample Output","value":{"format":"HTML","content":"\u003cdiv style\u003d\"font-family: courier new,courier,monospace\"\u003e\n 2\n\u003c/div\u003e"}},{"title":"Hint","value":{"format":"HTML","content":"\u003cp\u003e 编号为2的奶牛输给了编号为1、3、4的奶牛,也就是说她的水平比这3头奶\u003cbr\u003e 牛都差。而编号为5的奶牛又输在了她的手下,也就是说,她的水平比编号为5的\u003cbr\u003e 奶牛强一些。于是,编号为2的奶牛的排名必然为第4,编号为5的奶牛的水平必\u003cbr\u003e 然最差。其他3头奶牛的排名仍无法确定。\u003c/p\u003e"}}]}