c = []
c = input().split()
r = int(c[0])
x = int(c[1])
y = int(c[2])
a = int(c[3])
b = int(c[4])
count = 0
sum = 0
if x == y and a == b:
    print(a-x)
    exit()
if x == a and y ==b:
    print(0)
    exit()
else:
    print(abs(int((b-y)/r)) + abs(int((a-x)/r))-1)
    exit()
