{"trustable":true,"sections":[{"title":"","value":{"format":"HTML","content":"\u003cp\u003eSome of Farmer John\u0027s \u003ci\u003eN\u003c/i\u003e cows (1 ≤ \u003ci\u003eN\u003c/i\u003e ≤ 80,000) are having a bad hair day! Since each cow is self-conscious about her messy hairstyle, FJ wants to count the number of other cows that can see the top of other cows\u0027 heads.\u003c/p\u003e\u003cp\u003eEach cow \u003ci\u003ei\u003c/i\u003e has a specified height \u003ci\u003eh\u003csub\u003ei\u003c/sub\u003e\u003c/i\u003e (1 ≤ \u003ci\u003eh\u003csub\u003ei \u003c/sub\u003e\u003c/i\u003e≤ 1,000,000,000) and is standing in a line of cows all facing east (to the right in our diagrams). Therefore, cow \u003ci\u003ei\u003c/i\u003e can see the tops of the heads of cows in front of her (namely cows \u003ci\u003ei\u003c/i\u003e+1, \u003ci\u003ei\u003c/i\u003e+2, and so on), for as long as these cows are strictly shorter than cow \u003ci\u003ei\u003c/i\u003e.\u003c/p\u003e\u003cp\u003eConsider this example:\u003c/p\u003e\u003cpre\u003e\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp; \u003d\u003cbr\u003e\u003d\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp; \u003d\u003cbr\u003e\u003d\u0026nbsp;\u0026nbsp; -\u0026nbsp;\u0026nbsp; \u003d\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp; Cows facing right --\u0026gt;\u003cbr\u003e\u003d\u0026nbsp;\u0026nbsp; \u003d\u0026nbsp;\u0026nbsp; \u003d\u003cbr\u003e\u003d - \u003d \u003d \u003d\u003cbr\u003e\u003d \u003d \u003d \u003d \u003d \u003d\u003cbr\u003e1 2 3 4 5 6 \u003c/pre\u003e\u003cp\u003eCow#1 can see the hairstyle of cows #2, 3, 4\u003cbr\u003eCow#2 can see no cow\u0027s hairstyle\u003cbr\u003eCow#3 can see the hairstyle of cow #4\u003cbr\u003eCow#4 can see no cow\u0027s hairstyle\u003cbr\u003eCow#5 can see the hairstyle of cow 6\u003cbr\u003eCow#6 can see no cows at all!\u003cbr\u003e\u003c/p\u003e\u003cp\u003eLet \u003ci\u003ec\u003csub\u003ei\u003c/sub\u003e\u003c/i\u003e denote the number of cows whose hairstyle is visible from cow \u003ci\u003ei\u003c/i\u003e; please compute the sum of \u003ci\u003ec\u003c/i\u003e\u003csub\u003e1\u003c/sub\u003e through \u003ci\u003ec\u003csub\u003eN\u003c/sub\u003e\u003c/i\u003e.For this example, the desired is answer 3 + 0 + 1 + 0 + 1 + 0 \u003d 5.\u003c/p\u003e"}},{"title":"Input","value":{"format":"HTML","content":"Line 1: The number of cows, \u003ci\u003eN\u003c/i\u003e.\r\u003cbr\u003eLines 2..N+1: Line \u003ci\u003ei\u003c/i\u003e+1 contains a single integer that is the height of cow \u003ci\u003ei\u003c/i\u003e."}},{"title":"Output","value":{"format":"HTML","content":"Line 1: A single integer that is the sum of \u003ci\u003ec\u003c/i\u003e\u003csub\u003e1\u003c/sub\u003e through \u003ci\u003ec\u003csub\u003eN\u003c/sub\u003e\u003c/i\u003e."}},{"title":"Sample","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e6\r\n10\r\n3\r\n7\r\n4\r\n12\r\n2\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e5\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}