X, Y, Z = map(int, input().split()) print(max(0, Z - (X<=Z) - (Y<=Z)))