Predicting the Number, Spatial Distribution, and Merging History of Dark Matter Halos