import sys input = lambda : sys.stdin.readline().rstrip() sys.setrecursionlimit(2*10**5+10) write = lambda x: sys.stdout.write(x+"\n") a,b,c,d = list(map(int, input().split())) if a==c or b==d or abs(a-c)+abs(b-d)<=3: ans = 1 else: ans = 2 print(ans)