a, b, c = map(int, input().split()) min = abs(a - c) if min > b - max([a, c]): min = b - max([a, c]) print(min)