A, B, C = map(int, input().split()) mx = B - max([A, C]) + 1 mn = abs(A - C) print(min([mx, mn]))