Cutting Bamboos

There are $n$ bamboos in a row. Khan the bamboo cutter is going to cut them all one by one. He can do one of the following operations at a time.


This is a companion discussion topic for the original entry at https://toph.co/p/cutting-bamboos