Assume G is a group of order pn, where p is an odd prime. Let sk(G) denote the number of subgroups of order pk of G. We give a criterion for a p-group to be with [Formula: see text] for each integer k satisfying [Formula: see text]. Moreover, such p-groups are classified.