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