implement bottom-n