Scattering formula for the topological quantum number of a disordered multimode wire