{"raw_statement":[{"iden":"problem statement","content":"You are given a sequence $A = (A_1, A_2, \\ldots, A_N)$ of length $N$.\nFind the maximum length of a subsequence of $A$ such that the absolute difference between any two adjacent terms is at most $D$.\nA subsequence of a sequence $A$ is a sequence that can be obtained by deleting zero or more elements from $A$ and arranging the remaining elements in their original order."},{"iden":"constraints","content":"*   $1 \\leq N \\leq 5 \\times 10^5$\n*   $0 \\leq D \\leq 5 \\times 10^5$\n*   $1 \\leq A_i \\leq 5 \\times 10^5$\n*   All input values are integers."},{"iden":"input","content":"The input is given from Standard Input in the following format:\n\n$N$ $D$\n$A_1$ $A_2$ $\\ldots$ $A_N$"},{"iden":"sample input 1","content":"4 2\n3 5 1 2"},{"iden":"sample output 1","content":"3\n\nThe subsequence $(3, 1, 2)$ of $A$ has absolute differences of at most $2$ between adjacent terms."},{"iden":"sample input 2","content":"5 10\n10 20 100 110 120"},{"iden":"sample output 2","content":"3"},{"iden":"sample input 3","content":"11 7\n21 10 3 19 28 12 11 3 3 15 16"},{"iden":"sample output 3","content":"6"}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}