Critical magnetic number in the magnetohydrodynamic Rayleigh-Taylor instability