Given $ A $ a $ n\times n $ integer matrix and $ (d_{1},...,d_{n}) $ the diagonal of its Smith Normal Form, I would like to prove that $ \mathbb{Z}^n/Im_{\mathbb{Z}}A\simeq \bigoplus_{i=1}^{n}(\mathbb{Z}/d_{i}\mathbb{Z}) $.
My idea was to use the fact that $ Im_{\mathbb{Z}}A=<H_{1},...,H_{r}> $ where the $ H_{i}'s $ are the nonzero columns of the Hermite Normal Form $H$ of $ A $ and $ r\leq n $, but I don't know how to go on from here, although it seems like an easy exercise.
I would really appreciate any ideas, hints or solutions. Thank you very much!