Implementation of phase estimation and quantum counting algorithms on an NMR quantum-information processor