import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); // your code goes here int[][] solution = new int[n-1][n-1]; for (int i=0; i queue = new LinkedList(); queue.add(inPoint); int X,Y; while(! queue.isEmpty()){ Point point = queue.poll(); if(point.x == n-1 && point.y == n-1) return point.steps; X=point.x+xMove; Y=point.y+yMove; if(validMove(chessBoard,n, X,Y)){ Point newPoint = new Point(X,Y,point.steps+1); chessBoard[X][Y] = 1; queue.add(newPoint); } X=point.x+xMove; Y=point.y-yMove; if(validMove(chessBoard,n, X,Y)){ Point newPoint = new Point(X,Y,point.steps+1); chessBoard[X][Y] = 1; queue.add(newPoint); } X=point.x-xMove; Y=point.y+yMove; if(validMove(chessBoard,n, X,Y)){ Point newPoint = new Point(X,Y,point.steps+1); chessBoard[X][Y] = 1; queue.add(newPoint); } X=point.x-xMove; Y=point.y-yMove; if(validMove(chessBoard,n, X,Y)){ Point newPoint = new Point(X,Y,point.steps+1); chessBoard[X][Y] = 1; queue.add(newPoint); } X=point.x+yMove; Y=point.y+xMove; if(validMove(chessBoard,n, X,Y)){ Point newPoint = new Point(X,Y,point.steps+1); chessBoard[X][Y] = 1; queue.add(newPoint); } X=point.x+yMove; Y=point.y-xMove; if(validMove(chessBoard,n, X,Y)){ Point newPoint = new Point(X,Y,point.steps+1); chessBoard[X][Y] = 1; queue.add(newPoint); } X=point.x-yMove; Y=point.y+xMove; if(validMove(chessBoard,n, X,Y)){ Point newPoint = new Point(X,Y,point.steps+1); chessBoard[X][Y] = 1; queue.add(newPoint); } X=point.x-yMove; Y=point.y-xMove; if(validMove(chessBoard,n, X,Y)){ Point newPoint = new Point(X,Y,point.steps+1); chessBoard[X][Y] = 1; queue.add(newPoint); } } return -1; } public static boolean validMove(int[][] chessBoard, int n , int x, int y){ return (x>=0 && x=0 && y