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(); assert(-1e9<=A&&A<=1e9); assert(-1e9<=B&&B<=1e9); assert(-1e9<=C&&C<=1e9); assert(-1e9<=D&&D<=1e9); 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));} }