import java.util.*; public class Osho{ public static void main(String... args){ Scanner scan = new Scanner(System.in); int x=scan.nextInt(),y=scan.nextInt(),x1=scan.nextInt(),y1=scan.nextInt(); int res = Math.max(x,y); if(Math.abs(x) == Math.abs(y) && Math.abs(x1) == Math.abs(y1) && Math.abs(x) > Math.abs(x1)){ if(x>0 && y>0 && x1>0 && y1>0){ res++; }else if(x>0 && y<0 && x1>0 && y1<0){ res++; }else if(x<0 && y>0 && x1<0 && y1>0){ res++; }else if(x<0 && y<0 && x1<0 && y1<0){ res++; } } System.out.println(res); } }