#abc214g. [abc214_g]Three Permutations

[abc214_g]Three Permutations

给出两个大小为 nn 的排列 p,qp,q,你需要求出大小为 nn 的排列 rr 的数量,使得 ripi,riqir_i\neq p_i,r_i\neq q_i