Completed hamming distance