Hint
COUNT is for pulses in a time period.

Maybe
if switch goes high
then
var = var + 1