Count the number of rising edges