{"raw_statement":[{"iden":"problem statement","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$."},{"iden":"constraints","content":"*   $1 \\leq N \\leq 5 \\times 10^5$\n*   $1 \\leq a_i \\leq 2N$\n*   All values in the input are integers."},{"iden":"input","content":"The input is given from Standard Input in the following format:\n\n$N$\n$a_1$ $\\ldots$ $a_{2N}$"},{"iden":"sample input 1","content":"3\n1 1 2 3 4 5"},{"iden":"sample output 1","content":"2\n\nThe following two divisions satisfy the condition.\n\n*   $(1,1,2,3,4,5)$\n*   $(1,1,2,3),(4,5)$"},{"iden":"sample input 2","content":"1\n1 2"},{"iden":"sample output 2","content":"1"},{"iden":"sample input 3","content":"1\n1 1"},{"iden":"sample output 3","content":"0"},{"iden":"sample input 4","content":"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"},{"iden":"sample output 4","content":"2048"}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}