Solution:
Let us denote by n the number of participating teams. The number of matches played during the whole tournament will be equal to n(n−1), as many as the ordered pairs of distinct elements of a set with n elements.
Let us denote by M the arithmetic mean of the total scores obtained by the teams at the end of the tournament. Since 2 points are assigned in each match, we have M=2n(n−1)/n=2(n−1).
Note that, since each team can only have obtained an even number of points, all the teams that finished neither in first nor in last place have gained at most 24 points. We then have
M⩽n26+24(n−3)+20⋅2=n66+24(n−3)=n24n−6<24.
On the other hand M is even and greater than 20, because all teams have at least 20 points and there is one that has more. Therefore the only possible value for M is 22, from which we obtain that the number of teams participating in the tournament is equal to 12.
Finally, it is easy to verify that there exists a tournament with 12 teams that satisfies the hypotheses of the problem. Indeed, if team A beats teams B and C in all their matches, while all the other matches end with one win each, at the end of the tournament A will have totaled 26 points, B and C will have totaled 20, and the other 9 participants will finish the tournament with 22 points.