the best chain is determined not by length(blocks) but by work(hashs).
I don't understood this. The number of calculated hashes is
not included into the block,
so there is no way to reliable determine the amount of work
each blockheader contains a field called "bits", the field describes how much of the hash should be 0's, before the block is considered valid. this number is the same as difficulty.
a difficulty adjustment every 2 weeks, adjusts the bits field, depending on the timestamps on the first and last block in that difficulty period. trying to match 2 week on average: if blocks are created too fast, difficulty rises; too slow, difficulty falls.