the basis of the hyperloglog algorithm is the observation that the cardinality of a multiset of uniformly distributed random numbers can be estimated by calculating the maximum number of leading zeros in the binary representation of each number in the set. if the maximum number of leading zeros observed is "n", an estimate for the number of distinct elements in the set is 2.