On Sampling and Approximate Counting