Z=input() A,B=map(int,input().split()) C,D=map(int,input().split()) print(abs(C-A)+abs(D-B))