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 for(int i=1;i q = new LinkedList(); boolean visited[][] = new boolean[n][n]; int top= -1; int x1=0,y1=0,x2=0,y2=0,step=0,min_steps=Integer.MAX_VALUE; boolean flag = false; Position temp; while(true){ step++; x2=x1+i; y2=y1+j; if(x2=0 && !visited[x2][y2]){ visited[x2][y2] = true; temp = new Position(x2,y2,step); q.add(temp); } x2=x1-i; y2=y1+j; if(x2>=0 && y2=0 && y2>=0 && !visited[x2][y2]){ visited[x2][y2] = true; temp = new Position(x2,y2,step); q.add(temp); } if(i!=j){ x2=x1+j; y2=y1+i; if(x2=0 && !visited[x2][y2]){ visited[x2][y2] = true; temp = new Position(x2,y2,step); q.add(temp); } x2=x1-j; y2=y1+i; if(x2>=0 && y2=0 && y2>=0 && !visited[x2][y2]){ visited[x2][y2] = true; temp = new Position(x2,y2,step); q.add(temp); } } // back track if(q.isEmpty()){ break; } temp = q.remove(); x1=temp.x; y1=temp.y; step=temp.step; if(x1==n-1 && y1==n-1){ flag=true; if(step