Generate the Temple Skyline Sequence
CJam, 25 23 22 bytes

ri1e&gt;2be`z($W%a\+ze~2b


Just a bit of run-length encoding. -1 thanks to @MartinBüttner.

Try it online / Test suite.

Explanation

ri        Read n from input as int
1e&gt;       Take max with 1 (special case for n = 0)
2b        Convert n to binary
e`        Run length encode
z         Zip, giving a pair [&lt;counts&gt; &lt;10101.. array&gt;]
($W%      Drop the counts array and sort decending
a\+z      Add it back to the 10101.. array and re-zip
e~        Run length decode
2b        Convert from binary