chefzot problem

Hi,
I’ve done CHEFZOT problem It’s givving wrong answer when submitted.I’ve seen editorial and my solution is bit different but givving exact output on all the given test cases.Please tell me why it’s givving “wrong answer”.

where is the link of your code?

http://www.codechef.com/viewsolution/4119391

what if all array elements are non-zero like
input
6
1 2 3 4 5 6
check the output and try to rectify it

//