{"trustable":false,"sections":[{"title":"","value":{"format":"HTML","content":"\u003cdiv class\u003d\"ptx\" lang\u003d\"en-US\"\u003eA 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.\u003c/div\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\u003cdiv class\u003d\"ptx\" lang\u003d\"en-US\"\u003eThe 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 \u003c/div\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003cdiv class\u003d\"ptx\" lang\u003d\"en-US\"\u003eOutput file must contain a single integer - the length of the longest ordered subsequence of the given sequence. \u003c/div\u003e"}},{"title":"Sample Input","value":{"format":"HTML","content":"\u003cpre class\u003d\"sio\"\u003e7\n1 7 3 5 9 4 8\u003c/pre\u003e"}},{"title":"Sample Output","value":{"format":"HTML","content":"\u003cpre class\u003d\"sio\"\u003e4\n\u003c/pre\u003e"}}]}