We consider the production of the J/psi mesons in heavy ion collisions at RHIC energies in the statistical coalescence model with an exact (canonical ensemble) charm conservation. The cc quark pairs are assumed to be created in the primary hard parton collisions, but the formation of the open and hidden charm particles takes place at the hadronization stage and follows the prescription of statistical mechanics. The dependence of the J/psi production on both the number of nucleon participants and the collision energy is studied. The model predicts the J/psi suppression for low energies, whereas at the highest RHIC energy the model reveals the J/psi enhancement