Cloth diapers- when and how to buy??

Need some advice on cloth diapers! I'm 21 weeks now, when should I start stocking up on diapers? And how much/many do you actually need? Should I go for a huge pack of them or start off slow and buy as the tiny one gets bigger? I hear varying reports of how many you need- anywhere from 10 to 40! Super confused. Any help would be so appreciated!!