N=int(input()) A=[[-1 for _ in range(N)] for _ in range(N)] d=0#direction i=0 j=-1# it should be -1 to start with 0,0 c=0 while c