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