Getting wrong anwser in sticks

https://www.codechef.com/viewsolution/36711095

please help me where i am wrong

anyone helpme

yes bro try this your input :-
1
6
4 4 2 2 2 2
your O/P- 4
but correct answer is =8

here is your code with slight changes and AC .CodeChef: Practical coding for everyone