Treatment of gains on recharacterized IRA contributions

I contributed $7500 to a traditional IRA in January 2023 and made 3 recharacterizations totaling $4800 to a Roth in July.   My custodian sent me a 1099-R with distribution code N showing $5300 which included $500 of earnings, none of it taxable.  Is my deductible IRA contribution $2700 (7500-4800) or $2200 (7500-5300)?