Nobody mention about -s option(?). From man ls:
-s, --size print the allocated size of each file, in blocks
.. so if you list with ls -s then you will get number of blocks for each directory and file in current directory. When you summarize it then you will get exactly the same number as in total: you see on top of ls -l.