l, r, m = map(int, input().split()) print(m if r > l + m else r - l + 1)