Subtraction of elements in the Mikrotik array (does not count the first element correctly)

Thanks a lot. This is what I need. Further, for my purposes, I redid the cycle like this

:foreach key,num in=$whereEnd do={
    if (($key % 2) = 0) do={
        :put "$($num - $previous)"
    } else={
        :set previous $num
    }
}