First sample description: Mirko bought boards of heights 1, 2, 3 and 4. Fences similar to Slavko’s
that he can build are:
{1,3,2,4} - niceness 2+1+2=5
{1,4,2,3} - niceness 3+2+1=6
{2,3,1,4} - niceness 1+2+3=6
{2,4,1,3} - niceness 2+3+2=7
{3,4,1,2} - niceness 1+3+1=5
n <= 300,000.