using System; using static System.Console; using System.Linq; using System.Collections.Generic; class Program { static int NN => int.Parse(ReadLine()); static int[] NList => ReadLine().Split().Select(int.Parse).ToArray(); static int[][] NArr(long n) => Enumerable.Repeat(0, (int)n).Select(_ => NList).ToArray(); static int[] LList(long n) => Enumerable.Repeat(0, (int)n).Select(_ => int.Parse(ReadLine())).ToArray(); public static void Main() { Solve(); } static void Solve() { var c = NList; if (c[0] == c[2] && c[1] == c[3]) WriteLine(0); else if (c[0] == c[2] || c[1] == c[3] || Math.Abs(c[0] - c[2]) + Math.Abs(c[1] - c[3]) <= 3) WriteLine(1); else WriteLine(2); } }