So if the school doesn’t offer a lot of AP in junior and below it will not be held against you at all. If you slacked junior and sophom*ore year it will help compensate but will likely not nullify it. (I can’t garuntee that but it seems likely)
Also everything is evaluated in context @Shaqoatmeal (employee of collegevine) said in another post schools typically send a “flyer” about your school which will list classes offered so if you took all 4 AP classes that were offered senior year that’s great but if you take 4 APs senior year when there were 20 offered you will be frowned upon. Also there is no magic number of AP classes to take but crsgo said something I agree with excluding APs that are in no way relevant ie AP Music and Art as a STEM major you should likely take 2-3rd to 3/4ths of all APs.
TLDR: It will compensate but will likely not nullify it.
Hope this helps and please comment if you need clarification as I’d be happy to help clarify!