The first loop executes the same number of times as the length of the list minus 1. However, we shouldn't forget we start from 0.
1
0
Seems like magic? Well, it's close. It's math.