Levinson’s theorem forS-matrix theory with inelasticity