Yes, the pgy-1 year counts as a year of medicine if you do it in medicine, or surgery if you do it there. Most places won't count a transitional year for anything, so you should be careful if you choose to do that. The match process is extremely complicated, but you can pick a prelim spot and a derm spot in the same city, but if you don't match in that derm spot, you can specify to go on to your next prelim spot matched with your next derm spot, or, most people have a few IM residencies or other specialties as back up on their eras. Those that don't can choose to match in their prelim year (you can choose not to match if you don't match in derm too), and re-apply during their prelim year, or, many take a year off to do research. Derm is extremely competetive for everyone right now, and the sad reality is that most people who apply don't match. Those that do are usually AOA, have high board scores, excellent letters of reccomendation, and many have derm research.