{"raw_statement":[{"iden":"problem statement","content":"We have a number sequence $A = (A_1, A_2, \\dots, A_N)$ of length $N$ and integers $X$ and $Y$. Find the number of pairs of integers $(L, R)$ satisfying all the conditions below.\n\n*   $1 \\leq L \\leq R \\leq N$\n*   The maximum value of $A_L, A_{L+1}, \\dots, A_R$ is $X$, and the minimum is $Y$."},{"iden":"constraints","content":"*   $1 \\leq N \\leq 2 \\times 10^5$\n*   $1 \\leq A_i \\leq 2 \\times 10^5$\n*   $1 \\leq Y \\leq X \\leq 2 \\times 10^5$\n*   All values in input are integers."},{"iden":"input","content":"Input is given from Standard Input in the following format:\n\n$N$ $X$ $Y$\n$A_1$ $A_2$ $\\dots$ $A_N$"},{"iden":"sample input 1","content":"4 3 1\n1 2 3 1"},{"iden":"sample output 1","content":"4\n\n$4$ pairs satisfy the conditions: $(L,R)=(1,3),(1,4),(2,4),(3,4)$."},{"iden":"sample input 2","content":"5 2 1\n1 3 2 4 1"},{"iden":"sample output 2","content":"0\n\nNo pair $(L,R)$ satisfies the condition."},{"iden":"sample input 3","content":"5 1 1\n1 1 1 1 1"},{"iden":"sample output 3","content":"15\n\nIt may hold that $X=Y$."},{"iden":"sample input 4","content":"10 8 1\n2 7 1 8 2 8 1 8 2 8"},{"iden":"sample output 4","content":"36"}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}