I don't get it. How does using else-if make it less complicated to count the number of instructions?
Personally, my inclination would be to rewrite the loop to tighten it up. But maybe the point was to show how quickly and dirtily one can do this... it definitely looks quick and dirty.