functions for averaging hamming distance over entire list