added function to compute counts of h1 with h2 as keys