a,b,c = map(int,input().split()) if c < a < b: print(min(b-a,a-c)) else: print(min(b-c,c-a))