# coding: utf-8
# (C) 2015, Laybson Plismenn / UFCG
import math

coord = map(int, raw_input().split())
hipo = math.sqrt((coord[3] - coord[1])**2 + (coord[4] - coord[2])**2)
ans = int(math.ceil(hipo)-coord[0]*2)

if ans <= 0:
    if (coord[1], coord[2]) == (coord[3] - coord[4]):
        print 0
    else:
        print 1
else:
    print ans
