x, y = map(int, raw_input().split()) x2, y2 = map(int, raw_input().split()) ans = max(abs(x), abs(y)) if abs(x) == abs(y) and abs(x2) == abs(y2): if (0 < x2 < x or x < x2 < 0) and (0 < y2 < y or y < y2 < 0): ans += 1 print ans