How is it showing less value then start

for the input
8
8 1 1 1 1 1 1 1 1
I thought min output will be no of cook so I assigned s = n later on realize for this sample test and is 1 but my o/p is coming right how is that possible and should lie in range of start and end
code-- https://ide.codingblocks.com/s/231541

u have taken start and end as wrong

refer to this code

I know that that’s what i am asking why is it showing correct result even if my start is n i.e 8 but how can ans become 1 - and the code is printing 1 as a ans please look at my code and mark me there what is wrong and also ans why it is giving correct ans despite my code is incorrect