Direct and Inverse Spectral Theory for the Hamiltonian System with Measure Coecients