// 2023 IUSB Programming Competition // Round 1 Problem 4 // Knight Movement // Solution by Liguo Yu import java.util.Scanner; public class round1_p4 { public static void main(String[] args) { Scanner input = new Scanner(System.in); int x1 = input.nextInt(); int y1 = input.nextInt(); int x2 = input.nextInt(); int y2 = input.nextInt(); int steps; if(x1==x2 && y1==y2) steps = 0; else if (oneStep(x1, y1, x2, y2)) steps = 1; else if (oneStep(x1, y1, x2+1, y2+2)) steps = 2; else if (oneStep(x1, y1, x2+1, y2-2)) steps = 2; else if (oneStep(x1, y1, x2-1, y2+2)) steps = 2; else if (oneStep(x1, y1, x2-1, y2-2)) steps = 2; else if (oneStep(x1, y1, x2+2, y2+1)) steps = 2; else if (oneStep(x1, y1, x2+2, y2-1)) steps = 2; else if (oneStep(x1, y1, x2-2, y2+1)) steps = 2; else if (oneStep(x1, y1, x2-2, y2-1)) steps = 2; else steps = -1; if(steps != -1) System.out.println(steps); else System.out.println(">2"); } public static boolean oneStep(int x1, int y1, int x2, int y2) { if((x2 == x1+1 && y2 == y1+2) || (x2 == x1+2 && y2 == y1+1) || (x2 == x1+1 && y2 == y1-2) || (x2 == x1+2 && y2 == y1-1) || (x2 == x1-1 && y2 == y1-2) || (x2 == x1-2 && y2 == y1-1) || (x2 == x1-1 && y2 == y1+2) || (x2 == x1-2 && y2 == y1+1)) return true; else return false; } }