depends. AOA is an important honor that is only given out to 10-15% of your medical school class and is taken into consideration when you apply. A lot of weight can be put on AOA, depending on the program.
on the other hand is your Step 1 score which is based off of ALL medical students in the country (like the MCAT). The better you do on this test, the better the chance you have at getting that top specialty.
I think more weight is put on Step 1 than AOA/Class rank.
I also want to say that no matter where you go to school, if you try hard enough you will get into what you want to do. You'll have grads from "lower ranked" med schools getting into difficult residencies with grads from Harvard. When people say "go where your gut tells you to," they aren't kidding. All the med schools are good.