using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Oushou_CS { class Program { static void Main(string[] args) { Sol mysol = new Sol(); mysol.Solve(); #if DEBUG Console.WriteLine("Press any key to continue..."); Console.ReadKey(); #endif } } class Sol { public void Solve() { int ans = ChebyshevDistance(0, 0, x, y); if(isObstacle(x,y,x2, y2)) { ans++; } Console.WriteLine(ans.ToString()); } int x, y, x2, y2; public Sol() { int[] xy = ria(); x = xy[0]; y = xy[1]; int[] xy2 = ria(); x2 = xy2[0]; y2 = xy2[1]; } static int ChebyshevDistance(int x1, int y1, int x2, int y2) { return Math.Max(Math.Abs(x1 - x2), Math.Abs(y1 - y2)); } // 象限を返す(0があるときも返す) static int Quadrant(int x, int y) { if (x > 0) { if (y > 0) { return 1; } else { return 4; } } else { if (y > 0) { return 2; } else { return 3; } } } static bool isObstacle(int x, int y, int x2, int y2) { int q1 = Quadrant(x, y); if ((Math.Abs(x) == Math.Abs(y)) && (Math.Abs(x2) == Math.Abs(y2)) && (q1 == Quadrant(x2, y2))) { int t = x - x2; if (((q1 == 1 || q1 == 4) && t>0) || ((q1 == 2 || q1 == 3) && t<0)) { return true; } } return false; } static String rs() { return Console.ReadLine(); } static int ri() { return int.Parse(Console.ReadLine()); } static long rl() { return long.Parse(Console.ReadLine()); } static double rd() { return double.Parse(Console.ReadLine()); } static String[] rsa() { return Console.ReadLine().Split(' '); } static int[] ria() { return Console.ReadLine().Split(' ').Select(e => int.Parse(e)).ToArray(); } static long[] rla() { return Console.ReadLine().Split(' ').Select(e => long.Parse(e)).ToArray(); } static double[] rda() { return Console.ReadLine().Split(' ').Select(e => double.Parse(e)).ToArray(); } } }