give cyclic array size n a_i value ith position repeat value let define permutation equal permutation value position transform perform cyclic rotation let define cyclic array b number component number connect component graph vertex position b add edge pair adjacent position b equal value note cyclic array position adjacentsFind expect value component permutation select equiprobably set different permutation