Approximate Counting, Phase Transitions And Geometry Of Polynomials