Pallet program, start with Wong number

Hi

I have to type zero for it to start with No. 1, if i type 1 it starts with no. 2 and so on. it is always counts incorrectly, how do I get it to take the number that I type? (see the program via the link below)
Sorry I started a new thread with this topic, but I can not see the answers to the first topic I created here in the forum?

Google Photos

cnt_1 = cnt_1 + 1
on the line following the operator assignment?

Thanks, i will try that

Thank you very much, it works, however it should be minus 1
cnt_1 = cnt_1 - 1

Question regarding depalletizing. when I set my layers to depalletize it always tries to remove the layer first before unloading parts, if I deselect the top layer then it does not off load the final layer. This is a pick and place application where I am unloading parts from a fixture (basket) then moving this basket “layer” out of the way to be stacked else where in the cell by the depalletizing process with layers.

How do I get it to pick not pick up the first layer until after it unloads the parts but still pick up the last layer?