add hamming distance