MATL, 17 15 bytes
-2 bytes thanks to Luis Mendo!
0i:oEqG:EqY"Ysh
Explanation for n=3
:
0 % push 0
i: % read input as integer, push range
% stack: [0, [1 2 3]]
o % modulo 2, stack: [0, [1 0 1]]
Eq % double and decrement, stack: [0, [1 -1 1]]
G: % push input and range again
% stack: [0, [1 -1 1], [1 2 3]]
Eq % double and decrement,
% stack: [0, [1 -1 1], [1 3 5]]
Y" % run-length decoding
% stack: [0, [1 -1 -1 -1 1 1 1 1 1]]
Ys % cumulative sum
% stack: [0, [1 0 -1 -2 -1 0 1 2 3 2 1 0 -1 -2 -3 -4 -3 -2 -1 0 1 2 3 4 5]3]]
h % horizontally concatenate
% end of program, automatically print the stack