Editorial - OCTAVE TUNES
We have a song of lengh N with each tone as a number from 1 to 8. We need to arrange the tones of the song in such a way that the number of times all the octave tones occur uniquely in ascending order is maximized. We cannot introduce any new tone but can swap the position of any two tones.
Since we can swap the position of any two tones, we can literally arrange the tones of the song in any way we want to. The problem hence reduces to how many complete octave tunes we can make. We keep a count of the occurences of each tone from 1 to 8. Since the octave musical tune has to be complete, the count of the tone having the lowest count will be the maximum beauty of the song.