5. Without loss of generality, we may assume that a≥b≥c≥d≥e. Then a−b=−(b−a)≥0,a−c≥b−c≥0,a−d≥b−d≥0 and a−e≥b−e≥0, and hence (a−b)(a−c)(a−d)(a−e)+(b−a)(b−c)(b−d)(b−e)≥0 Analogously, (d−a)(d−b)(d−c)(d−e)+(e−a)(e−b)(e−c)(e−d)≥0. Finally, (c−a)(c−b)(c−d)(c−e)≥0 as a product of two nonnegative numbers, from which the inequality stated in the problem follows. Remark. The problem in an alternative formulation, accepted for the IMO, asked to prove that the analogous inequality (a1−a2)(a1−a2)⋯(a1−an)+(a2−a1)(a2−a3)⋯(a2−an)+⋯+(an−a1)(an−a2)⋯(an−an−1)≥0 holds for arbitrary real numbers ai if and only if n=3 or n=5. The case n=3 is analogous to n=5. For n=4, a counterexample is a1=0,a2=a3=a4=1, while for n>5 one can take a1=a2=⋯=an−4=0,an−3=an−2=an−1=2,an=1 as a counterexample.