def main(): x_dst, y_dst = list(map( int, input().split() )) x_fu, y_fu = list(map( int, input().split() )) # ゴールが対角線上かつ,その通り道に歩がいる場合のみ # 1回無駄な動きが生じる move = 0 if x_dst == y_dst: if x_dst > 0 and y_dst > 0 and x_fu > 0 and y_fu > 0 and x_fu == y_fu and x_dst > x_fu: move += 1 if x_dst < 0 and y_dst > 0 and x_fu < 0 and y_fu > 0 and x_fu == y_fu and x_dst < x_fu: move += 1 if x_dst < 0 and y_dst < 0 and x_fu < 0 and y_fu < 0 and x_fu == y_fu and x_dst < x_fu: move += 1 if x_dst > 0 and y_dst < 0 and x_fu > 0 and y_fu < 0 and x_fu == y_fu and x_dst > x_fu: move += 1 move += x_dst print(move) else: x_dst_abs, y_dst_abs = abs(x_dst), abs(y_dst) bigger = max(x_dst_abs, y_dst_abs) smaller = min(x_dst_abs, y_dst_abs) move = (bigger - smaller) + smaller print(move) main()