a,b,c,d = map(int,input().split()) ans = 2 if a == c or b == d or abs(a-c)+abs(b-d) <= 3: ans = 1 print(ans)