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