{"trustable":true,"prependHtml":"\u003cscript\u003e window.katexOptions \u003d { disable: true }; \u003c/script\u003e\n\u003cscript type\u003d\"text/x-mathjax-config\"\u003e\n MathJax.Hub.Config({\n tex2jax: {\n inlineMath: [[\u0027$$$\u0027,\u0027$$$\u0027], [\u0027$\u0027,\u0027$\u0027]],\n displayMath: [[\u0027$$$$$$\u0027,\u0027$$$$$$\u0027], [\u0027$$\u0027,\u0027$$\u0027]]\n }\n });\n\u003c/script\u003e\n\u003cscript async src\u003d\"https://mathjax.codeforces.org/MathJax.js?config\u003dTeX-AMS-MML_HTMLorMML\" type\u003d\"text/javascript\"\u003e\u003c/script\u003e","sections":[{"title":"","value":{"format":"HTML","content":"\u003cdiv class\u003d\"panel_content\"\u003eDo you like painting? Little D doesn\u0027t like painting, especially messy color paintings. Now Little B is painting. To prevent him from drawing messy painting, Little D asks you to write a program to maintain following operations. The specific format of these operations is as follows.\u003cbr\u003e\u003cbr\u003e$0$ : clear all the points.\u003cbr\u003e\u003cbr\u003e$1$ $x$ $y$ $c$ : add a point which color is $c$ at point $(x,y)$.\u003cbr\u003e\u003cbr\u003e$2$ $x$ $y_1$ $y_2$ : count how many different colors in the square $(1,y1)$ and $(x,y2)$. That is to say, if there is a point $(a,b)$ colored $c$, that $1 \\leq a \\leq x$ and $y_1 \\leq b \\leq y_2$, then the color $c$ should be counted.\u003cbr\u003e\u003cbr\u003e$3$ : exit.\u003cbr\u003e\u003c/div\u003e"}},{"title":"Input","value":{"format":"HTML","content":"The input contains many lines. \u003cbr\u003e\u003cbr\u003eEach line contains a operation. It may be \u00270\u0027, \u00271 x y c\u0027 ( $1\\leq x,y\\leq 10^6,0\\leq c \\leq 50$ ), \u00272 x y1 y2\u0027 ($1\\leq x,y_1,y_2\\leq 10^6$ ) or \u00273\u0027. \u003cbr\u003e\u003cbr\u003e$x,y,c,y1,y2$ are all integers.\u003cbr\u003e\u003cbr\u003eAssume the last operation is 3 and it appears only once.\u003cbr\u003e\u003cbr\u003eThere are at most $150000$ continuous operations of operation 1 and operation 2. \u003cbr\u003e\u003cbr\u003eThere are at most $10$ operation 0. \u003cbr\u003e\u003cbr\u003e"}},{"title":"Output","value":{"format":"HTML","content":"For each operation 2, output an integer means the answer .\u003cbr\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\u003e0\r\n1 1000000 1000000 50\r\n1 1000000 999999 0\r\n1 1000000 999999 0\r\n1 1000000 1000000 49\r\n2 1000000 1000000 1000000\r\n2 1000000 1 1000000\r\n0\r\n1 1 1 1\r\n2 1 1 2\r\n1 1 2 2\r\n2 1 1 2\r\n1 2 2 2\r\n2 1 1 2\r\n1 2 1 3\r\n2 2 1 2\r\n2 10 1 2\r\n2 10 2 2\r\n0\r\n1 1 1 1\r\n2 1 1 1\r\n1 1 2 1\r\n2 1 1 2\r\n1 2 2 1\r\n2 1 1 2\r\n1 2 1 1\r\n2 2 1 2\r\n2 10 1 2\r\n2 10 2 2\r\n3\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e2\r\n3\r\n1\r\n2\r\n2\r\n3\r\n3\r\n1\r\n1\r\n1\r\n1\r\n1\r\n1\r\n1\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}