{"problem":{"name":"2D Plane 2N Points","description":{"content":"On a two-dimensional plane, there are $N$ red points and $N$ blue points. The coordinates of the $i$\\-th red point are $(a_i, b_i)$, and the coordinates of the $i$\\-th blue point are $(c_i, d_i)$. A r","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":2000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"arc092_a"},"statements":[{"statement_type":"Markdown","content":"On a two-dimensional plane, there are $N$ red points and $N$ blue points. The coordinates of the $i$\\-th red point are $(a_i, b_i)$, and the coordinates of the $i$\\-th blue point are $(c_i, d_i)$.\nA red point and a blue point can form a _friendly pair_ when, the $x$\\-coordinate of the red point is smaller than that of the blue point, and the $y$\\-coordinate of the red point is also smaller than that of the blue point.\nAt most how many friendly pairs can you form? Note that a point cannot belong to multiple pairs.\n\n## Constraints\n\n*   All input values are integers.\n*   $1 \\leq N \\leq 100$\n*   $0 \\leq a_i, b_i, c_i, d_i < 2N$\n*   $a_1, a_2, ..., a_N, c_1, c_2, ..., c_N$ are all different.\n*   $b_1, b_2, ..., b_N, d_1, d_2, ..., d_N$ are all different.\n\n## Input\n\nInput is given from Standard Input in the following format:\n\n$N$\n$a_1$ $b_1$\n$a_2$ $b_2$\n$:$\n$a_N$ $b_N$\n$c_1$ $d_1$\n$c_2$ $d_2$\n$:$\n$c_N$ $d_N$\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"arc092_a","tags":[],"sample_group":[["3\n2 0\n3 1\n1 3\n4 2\n0 4\n5 5","2\n\nFor example, you can pair $(2, 0)$ and $(4, 2)$, then $(3, 1)$ and $(5, 5)$."],["3\n0 0\n1 1\n5 2\n2 3\n3 4\n4 5","2\n\nFor example, you can pair $(0, 0)$ and $(2, 3)$, then $(1, 1)$ and $(3, 4)$."],["2\n2 2\n3 3\n0 0\n1 1","0\n\nIt is possible that no pair can be formed."],["5\n0 0\n7 3\n2 2\n4 8\n1 6\n8 5\n6 9\n5 4\n9 1\n3 7","5"],["5\n0 0\n1 1\n5 5\n6 6\n7 7\n2 2\n3 3\n4 4\n8 8\n9 9","4"]],"created_at":"2026-03-03 11:01:14"}}