Separating endogenous ancient DNA from present-day contamination