Let C be a closed subset of a topological space X, and let f = C → X. Let us assume that f is continuous and f(x) ∈ C for every x ∈ ∂C. How many times can one iterate f? This paper provides estimates on the number of iterations and examples of their optimality. In particular, we show how some topological properties of f, C and X are related to the maximal number of iterations, both in the case of functions and in the more general case of set-valued maps.We also show how this problem is related to the existence of equilibria for stochastic games