Store median and reset counters.