Counting without sampling: new algorithms for enumeration problems using statistical physics