You don't need a free format, a simple select question works.
Make the "yes" an "other, specify."
When they type in a value, "yes" is automatically selected.
Just set the "other, specify" to be numeric with the value range that applies.
If they click, "no" the number of times is blank.