a,b,c=map(int,input().split()) print(min(b-a, b-c))