Answer
For odd n, number of blocks = $\frac{n^2+2n+1}{4}$
For even n, number of blocks = $\frac{n^2+2n}{4}$
Work Step by Step
For odd n, let n=2k+1
number of blocks $=1+3+5+...+(2k-1)+(2k+1) = (k+1)^2$
[sum of first n odd numbers = $n^2$]
now $$n=2k+1$$ implies $$k = \frac{n-1}{2}$$
therefore, $$k+1 = \frac{n-1}{2}+1 = \frac{n+1}{2}$$
or, number of blocks $ = (k+1)^2 = (\frac{n+1}{2})^2 =\frac{n^2+2n+1}{4} $
For even n, let n = 2k
number of blocks $= 2+4+6+...+(n-2) +n$
$ = 2+4+6+...+2k $
$= 2(1+2+3+...+k)$
$=2\frac{k(k+1)}{2} = k(k+1)$
$=\frac{n}{2}(\frac{n}{2}+1)$
= $\frac{n^2+2n}{4}$