Relation between the free energy and the direct correlation function in the mean spherical approximation