Let $V \subset Y$ be the maximal open over which $f$ is an isomorphism. Then $V$ contains all codimension $1$ points of $V$ (Varieties, Lemma \ref{varieties-lemma-modification-normal-iso-over-codimension-1}). Let $y \in Y$ be a closed point not contained in $V$. Then we want to show that $f$ factors through the blowup $b : Y' \to Y$ of $Y$ at $y$. Namely, if this is true, then at least one (and in fact exactly one) component of the fibre $f^{-1}(y)$ will map isomorphically onto the exceptional curve in $Y'$ and the number of curves in fibres of $X \to Y'$ will be strictly less that the number of curves in fibres of $X \to Y$, so we conclude by induction. Some details omitted. \medskip\noindent By Lemma \ref{lemma-extend-rational-map-blowing-up} we know that there exists a sequence of blowing ups $$ X' = X_n \to X_{n - 1} \to \ldots \to X_1 \to X_0 = X $$ in closed points lying over the fibre $f^{-1}(y)$ and a morphism $X' \to Y'$ such that $$ \xymatrix{ X' \ar[d]_{f'} \ar[r] & X \ar[d]^f \\ Y' \ar[r] & Y } $$ is commutative. We want to show that the morphism $X' \to Y'$ factors through $X$ and hence we can use induction on $n$ to reduce to the case where $X' \to X$ is the blowup of $X$ in a closed point $x \in X$ mapping to $y$. \medskip\noindent Let $E \subset X'$ be the exceptional fibre of the blowing up $X' \to X$. If $E$ maps to a point in $Y'$, then we obtain the desired factorization by Lemma \ref{lemma-factor-through-contraction}. We will prove that if this is not the case we obtain a contradiction. Namely, if $f'(E)$ is not a point, then $E' = f'(E)$ must be the exceptional curve in $Y'$. Picture $$ \xymatrix{ E \ar[r] \ar[d]_g & X' \ar[d]_{f'} \ar[r] & X \ar[d]^f \\ E' \ar[r] & Y' \ar[r] & Y } $$ Arguing as before $f'$ is an isomorphism in an open neighbourhood of the generic point of $E'$. Hence $g : E \to E'$ is a finite birational morphism. Then the inverse of $g$ (a rational map) is everywhere defined by Morphisms, Lemma \ref{morphisms-lemma-extend-across} and $g$ is an isomorphism. Consider the map $$ g^*\mathcal{C}_{E'/Y'} \longrightarrow \mathcal{C}_{E/X'} $$ of Morphisms, Lemma \ref{morphisms-lemma-conormal-functorial}. Since the source and target are invertible modules of degree $1$ on $E = E' = \mathbf{P}^1_\kappa$ and since the map is nonzero (as $f'$ is an isomorphism in the generic point of $E$) we conclude it is an isomorphism. By Morphisms, Lemma \ref{morphisms-lemma-two-immersions} we conclude that $\Omega_{X'/Y'}|_E = 0$. This means that $f'$ is unramified at every point of $E$ (Morphisms, Lemma \ref{morphisms-lemma-unramified-at-point}). Hence $f'$ is quasi-finite at every point of $E$ (Morphisms, Lemma \ref{morphisms-lemma-unramified-quasi-finite}). Hence the maximal open $V' \subset Y'$ over which $f'$ is an isomorphism contains $E'$ by Varieties, Lemma \ref{varieties-lemma-modification-normal-iso-over-codimension-1}. This in turn implies that the inverse image of $y$ in $X'$ is $E'$. Hence the inverse image of $y$ in $X$ is $x$. Hence $x \in X$ is in the maximal open over which $f$ is an isomorphism by Varieties, Lemma \ref{varieties-lemma-modification-normal-iso-over-codimension-1}. This is a contradiction as we assumed that $y$ is not in this open.