Isomorphic $R$-modules

How can i show that two $R$-modules of finite rank are isomorphic if and only if they have the same rank. i.e $R^n \cong R^m$ iff $n=m$ .

-

Use Krull's theorem to find a maximal ideal $\mathfrak{m}$ of $R$ and use the fact that since $R^n\cong R^m$ as $R$-modules that $(R/\mathfrak{m})\otimes_R R^n\cong (R/\mathfrak{m})\otimes_R R^m$ as $R/\mathfrak{m}$-modules. But, from basic module theory this is just $(R/\mathfrak{m})^n\cong(R/\mathfrak{m})^m$ and so we've reduced the problem from general rings to fields--something you should be familiar with.