O=print R=range N=int(input()) if N<3:exit(O(-1)) O(N*N*2) for i in R(N): for j in R(N): for k in[i,(i+1)%N]:O(i*N+j+1,k*N+(i+j+1-k)%N+1)