{"trustable":true,"sections":[{"title":"","value":{"format":"HTML","content":"A numeric sequence of \u003ci\u003ea\u003csub\u003ei\u003c/sub\u003e\u003c/i\u003e is ordered if \u003ci\u003ea\u003csub\u003e1\u003c/sub\u003e\u003c/i\u003e \u0026lt; \u003ci\u003ea\u003csub\u003e2\u003c/sub\u003e\u003c/i\u003e \u0026lt; ... \u0026lt; \u003ci\u003ea\u003csub\u003eN\u003c/sub\u003e\u003c/i\u003e. Let the subsequence of the given numeric sequence (\u003ci\u003ea\u003csub\u003e1\u003c/sub\u003e\u003c/i\u003e, \u003ci\u003ea\u003csub\u003e2\u003c/sub\u003e\u003c/i\u003e, ..., \u003ci\u003ea\u003csub\u003eN\u003c/sub\u003e\u003c/i\u003e) be any sequence (\u003ci\u003ea\u003csub\u003ei\u003csub\u003e1\u003c/sub\u003e\u003c/sub\u003e\u003c/i\u003e, \u003ci\u003ea\u003csub\u003ei\u003csub\u003e2\u003c/sub\u003e\u003c/sub\u003e\u003c/i\u003e, ..., \u003ci\u003ea\u003csub\u003ei\u003csub\u003eK\u003c/sub\u003e\u003c/sub\u003e\u003c/i\u003e), where 1 \u0026lt;\u003d \u003ci\u003ei\u003csub\u003e1\u003c/sub\u003e\u003c/i\u003e \u0026lt; \u003ci\u003ei\u003csub\u003e2\u003c/sub\u003e\u003c/i\u003e \u0026lt; ... \u0026lt; \u003ci\u003ei\u003csub\u003eK\u003c/sub\u003e\u003c/i\u003e \u0026lt;\u003d \u003ci\u003eN\u003c/i\u003e. For example, sequence (1, 7, 3, 5, 9, 4, 8) has ordered subsequences, e. g., (1, 7), (3, 4, 8) and many others. All longest ordered subsequences are of length 4, e. g., (1, 3, 5, 8).\u003cbr\u003e\u003cbr\u003eYour program, when given the numeric sequence, must find the length of its longest ordered subsequence."}},{"title":"Input","value":{"format":"HTML","content":"The first line of input file contains the length of sequence N. The second line contains the elements of sequence - N integers in the range from 0 to 10000 each, separated by spaces. 1 \u0026lt;\u003d N \u0026lt;\u003d 1000 "}},{"title":"Output","value":{"format":"HTML","content":"Output file must contain a single integer - the length of the longest ordered subsequence of the given sequence. "}},{"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\u003e7\r\n1 7 3 5 9 4 8\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e4\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}