Per IRS Instructions for Form 5329 Additional Taxes on Qualified Plans (Including IRAs) and Other Tax-Favored Accounts, on page 4:
The additional tax on early distributions doesn’t apply to the distributions described next. Enter on line 2 the amount that you can exclude. In the space provided, enter the applicable exception number (01–12). If more than one exception applies, enter 12.
Exception No. 05 Qualified retirement plan distributions up to the amount you paid for unreimbursed medical expenses during the year minus 7.5% of your adjusted gross income (AGI) for the year.
Note that any link in the information above is updated each year automatically and will take you to the most recent version of the document at the time it is accessed.