input: caoccaol output 4 不一定是n-1,可能是n-2,取决于交换闭环的数量