An Index Formula for Supersymmetric Quantum Mechanics