Exact topological classification of Hamiltonian flows on smooth two-dimensional surfaces