ar = [int(s) for s in input().split()]
move =  (  abs(ar[1]-ar[3]) +  abs(ar[2]-ar[4])  ) /  (2*ar[0])  

if   int(move) == move :
    print(int(move) )
elif ar[3]-ar[1] >= 0  and  ar[4]-ar[2] >= 0:
    print(int(move) +1 )
else :
    print(int(move))

