nblocks function

get the number of blocks