{"raw_statement":[{"iden":"problem statement","content":"There are $N$ customers named $1,\\ldots,N$ visiting a shop. Customer $i$ arrives at time $A_i$ and leaves at time $B_i$. The queue order is _first in-first out_, so $A_i$ are increasing, and $B_i$ are increasing. Additionally, all $A_i$ and $B_i$ are pairwise distinct.\nAt the entrance there's a list of visitors to put their names in. Each customer will write down their name next in the list exactly once, either when they arrive or when they leave. How many different orders of names can there be in the end? Find the count modulo $998\\,244\\,353$."},{"iden":"constraints","content":"*   $1 \\leq N \\leq 5 \\cdot 10^5$\n*   $1 \\leq A_i < B_i \\leq 2N$\n*   $A_i < A_{i + 1}$ ($1 \\leq i \\leq N - 1$)\n*   $B_i < B_{i + 1}$ ($1 \\leq i \\leq N - 1$)\n*   $A_i \\neq B_j$ ($i \\neq j$)\n*   All values in the input are integers."},{"iden":"input","content":"Input is given from Standard Input in the following format:\n\n$N$\n$A_1$ $B_1$\n$\\vdots$\n$A_N$ $B_N$"},{"iden":"sample input 1","content":"3\n1 3\n2 5\n4 6"},{"iden":"sample output 1","content":"3\n\nThe possible orders are $(1, 2, 3)$, $(2, 1, 3)$, $(1, 3, 2)$."},{"iden":"sample input 2","content":"4\n1 2\n3 4\n5 6\n7 8"},{"iden":"sample output 2","content":"1\n\nThe only possible order is $(1, 2, 3, 4)$."}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}