calc queue length in pop