{"problem":{"name":"GCD Permutation","description":{"content":"Given is a permutation $P=(P_1,P_2,\\ldots,P_N)$ of the integers from $1$ through $N$. Find the number of pairs of integers $(i,j)$ such that $1\\leq i\\leq j\\leq N$ satisfying $GCD(i,j)\\neq 1$ and $GCD(","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":5000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"abc230_g"},"statements":[{"statement_type":"Markdown","content":"Given is a permutation $P=(P_1,P_2,\\ldots,P_N)$ of the integers from $1$ through $N$.\nFind the number of pairs of integers $(i,j)$ such that $1\\leq i\\leq j\\leq N$ satisfying $GCD(i,j)\\neq 1$ and $GCD(P_i,P_j)\\neq 1$.  \nHere, for positive integers $x$ and $y$, $GCD(x,y)$ denotes the greatest common divisor of $x$ and $y$.\n\n## Constraints\n\n*   $1 \\leq N \\leq 2\\times 10^5$\n*   $(P_1,P_2,\\ldots,P_N)$ is a permutation of $(1,2,\\ldots,N)$.\n*   All values in input are integers.\n\n## Input\n\nInput is given from Standard Input in the following format:\n\n$N$\n$P_1$ $P_2$ $\\ldots$ $P_N$\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"abc230_g","tags":[],"sample_group":[["6\n5 1 3 2 4 6","6\n\nSix pairs $(3,3)$, $(3,6)$, $(4,4)$, $(4,6)$, $(5,5)$, $(6,6)$ satisfy the condition, so $6$ should be printed."],["12\n1 2 3 4 5 6 7 8 9 10 11 12","32"]],"created_at":"2026-03-03 11:01:13"}}