Is the author's solution right ONEVALUE problem

Yesterday, codechef hold CODEATHON 2020 (link: https://www.codechef.com/COTH2020/), in problem One value (CODE: ONEVALUE) (link: https://www.codechef.com/COTH2020/problems/ONEVALUE) had an accepted solution (https://www.codechef.com/viewsolution/34457563), 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 ]