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