let c_1 c_2 ldot c_n permutation integer 1 2 ldot n consider subsegment permutation contain integer x give integer m integer x good exactly m different value maximum subsegmentsCirno study mathematic teacher ask count number permutation length n exactly k good numbersunfortunately Cirno is not good mathematic can not answer question therefore ask helpsince answer big need tell number permutation modulo pa permutation array consist n distinct integer 1 n arbitrary order for example 23154 permutation 122 permutation 2 appear twice array 134 permutation n3 4 arrayA sequence subsegment sequence b obtain b deletion possibly zero element begin possibly zero element end