#n, m = input().split()
#n = int (n)
#m = int (m)
#k = int (k)
#s = input()
#n = int(input())

a = list(map(int, input().split()))
#b = list(map(int, input().split()))

#x1, y1, x2, y2 =map(int,input().split())
#n = int(input())
#f = []
#f = [0]*n
#t = [0]*n
#f = []
    
#h = [""] * n
#f1 = sorted(f, key = lambda tup: tup[0])

#f1 = sorted(t, key = lambda tup: tup[0])
if (a[1] == a[3] and a[2] == a[4]):
    print(0)
else:
    if ((abs(a[1]-a[3])+ abs(a[2]-a[4])) % (2*a[0]) == 0):
        s = (abs(a[1]-a[3])+ abs(a[2]-a[4])) / (2*a[0])
       
    else:
         s = (abs(a[1]-a[3])+ abs(a[2]-a[4])) / (2*a[0])+1
    print(int(s))
