IRA distribution & contribution help

I'm 60, in 2024 I had to take a 4,000 distribution from my IRA. They withheld tax. Months later I made a contribution of 5,000. Will I be able to use the entire 5,000 to lower my AGI (I'm self employed/ low income) or will it only lower it by 1,000? Thank you!