Is the author's solution right ONEVALUE problem

Yesterday, codechef hold CODEATHON 2020 (link: Contest Page | CodeChef), in problem One value (CODE: ONEVALUE) (link: CodeChef: Practical coding for everyone) had an accepted solution (CodeChef: Practical coding for everyone), but I found out that solution is wrong, for example test case 7 2 1 2 3 2 4 2, the right answer should be 3, but the accepted solution give 4 as result. Is I wrong
[2 1 2 3 2 4 2] → [2 2 2 3 2 4 2] → [2 2 2 2 2 4 2] → [2 2 2 2 2 2 2 ]