Hamming distance problem