Let $G$ and $H$ be two abelian groups and let $n>1, m>1$ be two different integers. How many different spaces $X$ (up to homotopy) do we have with the property $\pi\_{n} X=G$ , $\pi\_{m} X=H$ and $\pi\_{\ast} X=0$ otherwise? is this number finite ? 



Eilenberg-Mac lane spaces and a generalization
Assuming $m > n$, there is a method for classifying such spaces using a technique from the Postnikov tower. Namely, such a space has a map $X \to K(G,n)$ inducing an isomorphism on $\pi\_n$, and if we convert this into a fibration it has fiber $K(H,m)$.


Such bundles are classified by a "k-invariant": an element in $H^{m+1}(K(G,n) ; H)$. One direction takes such a cohomology class, represents it as a map $K(G,n) \to K(H,m+1)$, and then takes a (homotopy) pullback. To see that this is actually a bijective correspondence requires a little bit of obstruction theory (and uses critically that $n > 1$; otherwise we'd also need to classify an action of $G$ on $H$).


One should note that if you only ask that $\pi\_n X$ and $\pi\_m X$ are abstractly isomorphic to $G$ and $H$ rather than choosing isomorphisms, the $k$-invariant is only well-defined up to the action of the automorphism groups $Aut(G)$ and $Aut(H)$ on $H^{m+1}(K(G,n); H)$. 


If $G$ and $H$ are finitely generated abelian groups and at least one of them is finite, then Serre's work using mod-$\cal C$ theory shows that this cohomology group is finite; however, in general you can certainly have infinitely many distinct isomorphism classes (e.g. there are infinitely many homotopy types with $\pi\_2 = \pi\_3 = \Bbb Z$, because $H^4 K(\Bbb Z,2) \cong \Bbb Z$).


