a,b,c = map(int,input().split()) ans = 0 if a ==c: print(abs(a-b)+1) exit() if a > c: a,c = c,a while a >= b or b >= c: if a > b: b+= 1 else: b -= 1 ans += 1 ans = min(ans,c-a) print(ans)