Get the correct number of elements in the array of commands