#JavaScript (ES6), 160 bytes
n=>(g=(o,v,p)=>[...Array(N=2*n),p+N-1,p+1,p+n].reduce((s,x,i)=>v>>(x=i<N?i:x%N)&1?s:s+g((i>=N)/p?[...o,p<x?p*n*n+x:x*n*n+p]:o,v|1<<x,x),g[o.sort()]^(g[o]=1)))``
#JavaScript (ES6), 160 bytes
n=>(g=(o,v,p)=>[...Array(N=2*n),p+N-1,p+1,p+n].reduce((s,x,i)=>v>>(x=i<N?i:x%N)&1?s:s+g((i>=N)/p?[...o,p<x?p*n*n+x:x*n*n+p]:o,v|1<<x,x),g[o.sort()]^(g[o]=1)))``