Wrong Answer in Chef and Numbers

Where am I wrong in the question CodeChef: Practical coding for everyone

Link to my submission

I think you haven’t considered this criteria:
If there are multiple answers, print the smallest one.

I have given the condition if count>maxcount it means if count is same as maxcount then it will not execute the if block so dish remains smallest one. I think there is any other problem. Please let me know if you get it as I am not able to understand the problem or any special cases where it will fail.

What if n=1? I think you can just do i in range(n).

I tried it but then also its wrong answer