Let $\phi:K\to X$ be a map, with mapping cyliner $M=X\cup_{\phi}(K\times I)$. We define $\pi_n (f)$ as $\pi_n (M,K\times 1)$. An element of $\pi_n (f)$ is represented by a pair of maps $\beta :S^{n-1}\to K$ and $\beta :D^n \to X$ with $\gamma |_{S^{n-1}}=f\circ \beta$. The map $\phi$ is called $n$-connected if $K$ and $X$ are connected and $\pi_i (\phi)=0$ for $1\leq i\leq n$.
Assume that $K^{n-1}$ is an $(n-1)$-dimensional CW-complex, $\phi :K^{n-1}\to X$ is an $(n-1)$-connected map such that $\phi_* :\pi_{n-1}(K^{n-1})\to \pi_{n-1}(X)$ is isomorphism, and $\pi_n (\phi)$ is a finitely generated free $\mathbb{Z}\pi_1 (X)$-module, and $\pi_n (X)$ is free as $\mathbb{Z}\pi_1 (X)$-module. C.T.C. Wall in his paper "Finiteness conditions for CW-complexes" says that we can attach finitely many $n$-cells to $K^{n-1}$, necessarily with trivial attaching maps, to make a CW-complex $K^n$.
My question: How many $n$-cells attaches to $K^{n-1}$? Can we determine it from $\pi_n (X)$?
My try: Since $\pi_n (\phi)$ is a finitely generated free $\mathbb{Z}\pi_1 (X)$-module (with the $\alpha_i$ as free generators), $H_n (\widetilde{K^n},\widetilde{K^{n-1}})=C_n (\widetilde{K^n})\cong H_n (\widetilde{X},\widetilde{K^{n-1}})\cong \pi_n (\phi)$ as $\mathbb{Z}\pi_1 (X)$-module. I guess that $\pi_n (K^n)$, $\pi_n (X)$ and $\pi_n (\phi)$ have the same rank, but I coudn't get it from the above isomorphisms.