# A puzzle related to nested loops

For a given input $N$, how many times does the enclosed statement executes?

for $i$ in $1\ldots N$ loop
$\quad$for $j$ in $1\ldots i$ loop
$\quad$$\quadfor k in i\ldots j loop \quad$$\quad$$\quad$$sum = sum + i$ ;

-