a=[int(i) for i in input().split()] b,c,d=a[0],a[1],a[2] if d>=b and d>=c: print(d-2) elif d>=b or d>=c: print(d-1) else: print(d-1)