X, Y, Z = map(int, input().split()) ans = 0 for z in range(Z): ans = max(ans, min(X + z, Y + Z - z)) print(ans)