Class Numbers of Indefinite Binary Quadratic Forms and the Residual Indices of Integers Modulo p