All test cases pass except first

your code is correct
actually the problem is with Testcase
testcase 1 is
5
1
2
2
2
3

hence your code take only first line of input and create wrong output

i will forward this issue with setter
and will be updated soon

i hope this helps
if yes hit a like and don’t forgot to mark doubt as resolved
if you have more doubts regarding this feel free to ask