{"problem":{"name":"Good Division","description":{"content":"A sequence $X$ is called **good** when the following holds. *   $X$ can be emptied by repeating the following operation zero or more times.     *   Delete two adjacent elements $x_i$ and $x_{i+1}$ of","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":5000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"arc159_f"},"statements":[{"statement_type":"Markdown","content":"A sequence $X$ is called **good** when the following holds.\n\n*   $X$ can be emptied by repeating the following operation zero or more times.\n    *   Delete two adjacent elements $x_i$ and $x_{i+1}$ of $X$ such that $x_i \\neq x_{i+1}$.\n\nYou are given a sequence with $2N$ elements: $A=(a_1,\\ldots,a_{2N})$.  \nAmong the $2^{2N-1}$ ways to divide $A$ into one or more contiguous subsequences, how many are such that all those contiguous subsequences are good? Find the count modulo $998244353$.\n\n## Constraints\n\n*   $1 \\leq N \\leq 5 \\times 10^5$\n*   $1 \\leq a_i \\leq 2N$\n*   All values in the input are integers.\n\n## Input\n\nThe input is given from Standard Input in the following format:\n\n$N$\n$a_1$ $\\ldots$ $a_{2N}$\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"arc159_f","tags":[],"sample_group":[["3\n1 1 2 3 4 5","2\n\nThe following two divisions satisfy the condition.\n\n*   $(1,1,2,3,4,5)$\n*   $(1,1,2,3),(4,5)$"],["1\n1 2","1"],["1\n1 1","0"],["12\n4 2 17 12 18 15 17 4 22 6 9 20 21 16 23 16 13 2 20 15 16 3 7 15","2048"]],"created_at":"2026-03-03 11:01:14"}}