Queueing Query with Maple

I have a queue with 1000 time intervals.

The average length over 1000 intervals was 2.718

I'm looking for the probabilities that a given state will jump up, $\displaystyle p_1$, or down, $\displaystyle p_2$

I ran the following through maple to count the number of times the queue moved up or down (qdata is the list of 1000 queue values):

nup:=0;

ndown:=0;

for i from 1 to 999 do

if qdata[i+1]>qdata[i] then

nup:=nup+1;

elif qdata[i+1]<qdata[i] then

ndown:=ndown+1;

end if;

end do:

p1:=evalf(nup/1000);

p2:=evalf(ndown/1000);

I ended up with $\displaystyle p_1 = 417$ and $\displaystyle p_2 =421$

I'm wondering if there is a problem here. Am I not taking into account when the queue length is zero and it has no probability of moving down?

Would it make sense to add this into the do loop:

elif qdata[i]=0 then

ndown:=ndown-1;

Or does the original code give the proper values? Am I missing something?