to help contestant struggle lot contest headquarters Codeforces planning introduce division 5 in new division tag problem announce prior round help contestantsThe contest consist n problem tag ith problem denote integer a_iYou want AK solve problem to solve problem order to contest funny create extra limitation you want solve problem consecutively tag bore also afraid big jump difficulty solve want minimize number time solve problem consecutively adjacent contest orderformally solve order describe permutation p length n the cost permutation define number index 1le p_i1p_i1 you requirement a_p_ine a_p_i1 1le nYou want know minimum possible cost permutation satisfie requirement if permutation meet requirement report