Inelastic neutron scattering study of phonons and magnetic excitations in LaCoO 3