Medium effects on charmonium production at ultrarelativistic energies available at the CERN Large Hadron Collider