Equalizing Pillars

There are $N$ pillars made of bricks. The height of each pillar is the number of bricks in that pillar.


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