Consider a finite sequence a1,a2,...,an whose terms are natural numbers at most equal to n. Determine the maximum number of terms of such a sequence, if you know that every two of its neighboring terms are different and at the same time there is no quartet of terms in it such that ap=ar=aq=as for p<q<r<s. combinatoricsCombinatorial Number TheorySequenceNumber sequencenational olympiad