input()
si, sj = map(int, input().split())
ti, tj = map(int, input().split())
print(abs(si - ti) + abs(sj - tj))