I have been told to interview 12 and rank at least 10.
Although in practice that plan will work out for most people, it's fundamentally a very poor strategy. Every rank list n programs long is actually n+1, with the +1 at the end of your list being the scramble.
You should make a draft rank list with EVERY program at which you interviewed. Look it over and decide where in that list you would prefer to scramble rather than match. Stop your rank list there. In most cases, you will interview at n programs and rank n programs. If they're all acceptable to you, it would be the height of arrogance and/or foolishness not to rank each and every one of them. Likewise, if you interviewed at 12 programs and 10 were miserable enough that you'd rather be an internist or wait a year and reapply, then only rank 2.