Correctly counting the number of iterations we should do through the loop when calculating the Merkle tree