use partition and count