<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def count_peaks(ts):
 """ Toggle counter for gas boilers Counts the number of times the gas consumption increases with more than 3kW Parameters ts: Pandas Series Gas consumption in minute resolution Returns ------- int """


    on_toggles = ts.diff() > 3000
    shifted = np.logical_not(on_toggles.shift(1))
    result = on_toggles & shifted
    count = result.sum()
    return count