import java.util.*; class Main { public static void main(String[] args) { new Main().run(); } void run() { Scanner sc=new Scanner(System.in); long A=sc.nextLong(); long B=sc.nextLong(); long C=sc.nextLong(); long D=sc.nextLong(); C-=A; D-=B; C=Math.abs(C); D=Math.abs(D); assert(!(C==0&&D==0)); if (C==0||D==0) { System.out.println(1); } else if (C+D<=3) { System.out.println(1); } else { System.out.println(2); } } void tr(Object...objects) {System.out.println(Arrays.deepToString(objects));} }