In this paper, we study how certain arithmetical conditions on the lengths of conjugacy classes of primary elements and π-elements of a finite group G influence the structure of G, some new results are obtained and several well-known results in the literature are developed. In particular, the structure of a kind of outer p-supersolvable groups is described, some new conditions implying π-supersolvability are found, and the upper bound for the order of Sylow subgroups is discussed.