{"raw_statement":[{"iden":"problem statement","content":"For a sequence $X$, let $f(X) =$ (the minimum number of elements one must modify to make $X$ a palindrome).\nGiven a sequence $A$ of length $N$, find the sum of $f(X)$ over all **contiguous** subarrays of $A$.\nHere, a sequence $X$ of length $m$ is said to be a palindrome if and only if the $i$\\-th and the $(m+1-i)$\\-th elements of $X$ are equal for all $1 \\le i \\le m$."},{"iden":"constraints","content":"*   All values in the input are integers.\n*   $1 \\le N \\le 2 \\times 10^5$\n*   $1 \\le A_i \\le N$"},{"iden":"input","content":"The input is given from Standard Input in the following format:\n\n$N$\n$A_1$ $A_2$ $\\dots$ $A_N$"},{"iden":"sample input 1","content":"5\n5 2 1 2 2"},{"iden":"sample output 1","content":"9\n\n*   $f(5) = 0$\n*   $f(2) = 0$\n*   $f(1) = 0$\n*   $f(2) = 0$\n*   $f(2) = 0$\n*   $f(5,2) = 1$\n*   $f(2,1) = 1$\n*   $f(1,2) = 1$\n*   $f(2,2) = 0$\n*   $f(5,2,1) = 1$\n*   $f(2,1,2) = 0$\n*   $f(1,2,2) = 1$\n*   $f(5,2,1,2) = 2$\n*   $f(2,1,2,2) = 1$\n*   $f(5,2,1,2,2) = 1$\n\nTherefore, the sought answer is $9$."}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}