Theory of staircase voltammetry