{"raw_statement":[{"iden":"problem statement","content":"You are given a sequence $A=(A_1,\\ldots,A_N)$ of length $N$. You perform the following operation exactly once.\n\n*   Choose a pair of integers $(L,R)$ such that $1\\leq L \\leq R \\leq N$. Replace each of $A_L,A_{L+1},\\ldots,A_R$ with $A_L$.\n\nHow many different sequences are possible as $A$ after the operation?"},{"iden":"constraints","content":"*   All input values are integers.\n*   $1 \\leq N \\leq 10^6$\n*   $1\\leq A_i \\leq N$"},{"iden":"input","content":"The input is given from Standard Input in the following format:\n\n$N$ \n$A_1$ $\\ldots$ $A_N$"},{"iden":"sample input 1","content":"4\n1 1 2 3"},{"iden":"sample output 1","content":"4\n\nThe possible sequences after the operation are the following four sequences:\n\n*   $(1,1,1,1)$\n*   $(1,1,1,3)$\n*   $(1,1,2,2)$\n*   $(1,1,2,3)$\n\nFor example, $(1,1,1,3)$ can be obtained by performing the operation with $L=2,R=3$."},{"iden":"sample input 2","content":"10\n2 5 6 5 2 1 7 9 7 2"},{"iden":"sample output 2","content":"41"}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}