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[][] A = new int[n][n]; int[][] v = new int[n][n]; boolean[][] visited = new boolean[n][n]; for(int i=0;i=A.length){ return -1; } if(start<0){ return -1; } if(end<0){ return -1; } if(end>=A.length){ return -1; } if(visited[start][end] == true){ return -1; } visited[start][end] = true; int count1 = KnightL(start+i,end+j,i,j,A,visited)+1; int count2 = KnightL(start-i,end-j,i,j,A,visited)+1; int count3 = KnightL(start+i,end-j,i,j,A,visited)+1; int count4 = KnightL(start-i,end+j,i,j,A,visited)+1; return Math.min(Math.min(count1,count2),Math.min(count3 , count4)); } }