{"raw_statement":[{"iden":"problem statement","content":"You are given an integer sequence $A = (A_1, A_2, \\ldots, A_N)$.\nFind the number of pairs of integers $(L, R)$ that satisfy the following conditions:\n\n*   $1 \\leq L \\leq R \\leq N$\n*   There is a number that appears exactly once among $A_L, A_{L + 1}, \\ldots, A_R$. More precisely, there is an integer $x$ such that exactly one integer $i$ satisfies $A_i = x$ and $L \\leq i \\leq R$."},{"iden":"constraints","content":"*   $2 \\leq N \\leq 2 \\times 10^5$\n*   $1 \\leq A_i \\leq N$\n*   All input values are integers."},{"iden":"input","content":"The input is given from Standard Input in the following format:\n\n$N$\n$A_1$ $A_2$ $\\ldots$ $A_N$"},{"iden":"sample input 1","content":"5\n2 2 1 2 1"},{"iden":"sample output 1","content":"12\n\n$12$ pairs of integers satisfy the conditions: $(L, R) = (1, 1), (1, 3), (1, 4), (2, 2), (2, 3), (2, 4), (3, 3), (3, 4), (3, 5), (4, 4), (4, 5), (5, 5)$."},{"iden":"sample input 2","content":"4\n4 4 4 4"},{"iden":"sample output 2","content":"4"},{"iden":"sample input 3","content":"10\n1 2 1 4 3 3 3 2 2 4"},{"iden":"sample output 3","content":"47"}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}