corrected reducer, using Hamming distance