{"problem":{"name":"Range Replace","description":{"content":"You are given a sequence $A=(A_1,\\ldots,A_N)$ of length $N$. You perform the following operation exactly once. *   Choose a pair of integers $(L,R)$ such that $1\\leq L \\leq R \\leq N$. Replace each of","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":2000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"arc206_a"},"statements":[{"statement_type":"Markdown","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?\n\n## Constraints\n\n*   All input values are integers.\n*   $1 \\leq N \\leq 10^6$\n*   $1\\leq A_i \\leq N$\n\n## Input\n\nThe input is given from Standard Input in the following format:\n\n$N$ \n$A_1$ $\\ldots$ $A_N$\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"arc206_a","tags":[],"sample_group":[["4\n1 1 2 3","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$."],["10\n2 5 6 5 2 1 7 9 7 2","41"]],"created_at":"2026-03-03 11:01:14"}}