Calculate allowable Roth contribution after SEP

How can the allowable Roth IRA contribution be  calculated in the following scenario?

The taxpayer is retired and, just for the example, expects to be in the 22% tax bracket.

The taxpayer earns just $3000 as  an  independent  contractor. This is  the entire earned income for the year. The taxpayer must pay SEP tax on this  income.

The taxpayer wants to contribute the maximum allowable  to a Roth IRA as soon as possible (assume it's early  in the  tax  year) but does not  wish to make an excess contribution that must later be withdrawn.

 

How does the taxpayer calculate the maximum amount they can contribute to a Roth IRA?