def main(): A, B, C, D = map(lambda x: abs(int(x)), input().split()) C -= A D -= B if C == 0 or D == 0: return 1 if abs(C) + abs(D) <= 3: return 1 return 2 print(main())